Debian安装PHP8.1
<p> <span style="font-style: italic">更新 Debian 系统</span></p><div>
<div>apt update</div>
<div>apt upgrade -y</div>
<div> </div>
</div>
<div>
<div>安装必要的依赖包</div>
<div>apt-get install ca-certificates apt-transport-https software-properties-common wget curl lsb-release -y</div>
<div> </div>
<div>下载安装 Ondřej Surý PHP 仓库的GPG密钥并导入</div>
<div>curl -sSL https://packages.sury.org/php/README.txt | bash -x</div>
<br>
<div>
<div>
<div>再次更新 Debian 源:</div>
<div>apt update</div>
<div>apt upgrade</div>
</div>
</div>
<div> </div>
<div>安装PHP8.1及相关包:</div>
<div>
<div>apt install php8.1 php8.1-common php8.1-fpm php8.1-cli php8.1-xml php8.1-mysql php8.1-mbstring php8.1-curl php8.1-gd php8.1-opcache php8.1-imagick php8.1-apcu php8.1-zip</div>
</div>
</div>
<div class="cnblogs_code">
<pre>Creating config <span style="color: rgba(0, 0, 255, 1)">file</span> /etc/php/<span style="color: rgba(128, 0, 128, 1)">8.1</span>/fpm/<span style="color: rgba(0, 0, 0, 1)">php.ini with new version
Created symlink </span>/etc/systemd/system/multi-user.target.wants/php8.<span style="color: rgba(128, 0, 128, 1)">1</span>-fpm.service → /lib/systemd/system/php8.<span style="color: rgba(128, 0, 128, 1)">1</span>-fpm.service.</pre>
</div>
<p> </p>
<p> 启动:</p>
<div>service php8.1-fpm start</div>
<div> </div>
<div>查看当前运行状态:</div>
<div>systemctl status php8.1-fpm <br>
<div class="cnblogs_code">
<pre>● php8.<span style="color: rgba(128, 0, 128, 1)">1</span>-fpm.service - The PHP <span style="color: rgba(128, 0, 128, 1)">8.1</span><span style="color: rgba(0, 0, 0, 1)"> FastCGI Process Manager
Loaded: loaded (</span>/lib/systemd/system/php8.<span style="color: rgba(128, 0, 128, 1)">1</span>-<span style="color: rgba(0, 0, 0, 1)">fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Sat </span><span style="color: rgba(128, 0, 128, 1)">2022</span>-<span style="color: rgba(128, 0, 128, 1)">04</span>-<span style="color: rgba(128, 0, 128, 1)">30</span> <span style="color: rgba(128, 0, 128, 1)">23</span>:<span style="color: rgba(128, 0, 128, 1)">06</span>:<span style="color: rgba(128, 0, 128, 1)">27</span><span style="color: rgba(0, 0, 0, 1)"> CST; 10h ago
Docs: man:php</span>-fpm8.<span style="color: rgba(128, 0, 128, 1)">1</span>(<span style="color: rgba(128, 0, 128, 1)">8</span><span style="color: rgba(0, 0, 0, 1)">)
Process: </span><span style="color: rgba(128, 0, 128, 1)">864</span> ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/<span style="color: rgba(128, 0, 128, 1)">8.1</span>/fpm/pool.d/www.conf <span style="color: rgba(128, 0, 128, 1)">81</span> (code=exited, status=<span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">SUCCESS)
Main PID: </span><span style="color: rgba(128, 0, 128, 1)">650</span> (php-fpm8.<span style="color: rgba(128, 0, 128, 1)">1</span><span style="color: rgba(0, 0, 0, 1)">)
Status: </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
Tasks: </span><span style="color: rgba(128, 0, 128, 1)">3</span> (limit: <span style="color: rgba(128, 0, 128, 1)">2242</span><span style="color: rgba(0, 0, 0, 1)">)
Memory: </span><span style="color: rgba(128, 0, 128, 1)">36.1M</span><span style="color: rgba(0, 0, 0, 1)">
CPU: </span><span style="color: rgba(128, 0, 128, 1)">1</span><span style="color: rgba(0, 0, 0, 1)">.167s
CGroup: </span>/system.slice/php8.<span style="color: rgba(128, 0, 128, 1)">1</span>-<span style="color: rgba(0, 0, 0, 1)">fpm.service
├─</span><span style="color: rgba(128, 0, 128, 1)">650</span> php-fpm: master process (/etc/php/<span style="color: rgba(128, 0, 128, 1)">8.1</span>/fpm/php-<span style="color: rgba(0, 0, 0, 1)">fpm.conf)
├─</span><span style="color: rgba(128, 0, 128, 1)">862</span> php-<span style="color: rgba(0, 0, 0, 1)">fpm: pool www
└─</span><span style="color: rgba(128, 0, 128, 1)">863</span> php-<span style="color: rgba(0, 0, 0, 1)">fpm: pool www
Apr </span><span style="color: rgba(128, 0, 128, 1)">30</span> <span style="color: rgba(128, 0, 128, 1)">23</span>:<span style="color: rgba(128, 0, 128, 1)">06</span>:<span style="color: rgba(128, 0, 128, 1)">26</span> iZrv8fu4iejmpkZ systemd[<span style="color: rgba(128, 0, 128, 1)">1</span>]: Starting The PHP <span style="color: rgba(128, 0, 128, 1)">8.1</span><span style="color: rgba(0, 0, 0, 1)"> FastCGI Process Manager...
Apr </span><span style="color: rgba(128, 0, 128, 1)">30</span> <span style="color: rgba(128, 0, 128, 1)">23</span>:<span style="color: rgba(128, 0, 128, 1)">06</span>:<span style="color: rgba(128, 0, 128, 1)">27</span> iZrv8fu4iejmpkZ systemd[<span style="color: rgba(128, 0, 128, 1)">1</span>]: Started The PHP <span style="color: rgba(128, 0, 128, 1)">8.1</span> FastCGI Process Manager.</pre>
</div>
<p> </p>
</div>
<p>查看当前版本:</p>
<p>php -v</p>
<div class="cnblogs_code">
<pre>PHP <span style="color: rgba(128, 0, 128, 1)">8.1</span>.<span style="color: rgba(128, 0, 128, 1)">5</span> (cli) (built: Apr <span style="color: rgba(128, 0, 128, 1)">22</span> <span style="color: rgba(128, 0, 128, 1)">2022</span> <span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">56</span>:<span style="color: rgba(128, 0, 128, 1)">05</span><span style="color: rgba(0, 0, 0, 1)">) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.</span><span style="color: rgba(128, 0, 128, 1)">1.5</span><span style="color: rgba(0, 0, 0, 1)">, Copyright (c) Zend Technologies
with Zend OPcache v8.</span><span style="color: rgba(128, 0, 128, 1)">1.5</span>, Copyright (c), by Zend Technologies</pre>
</div>
<p> </p>
<p>查看已加载的模块:</p>
<div> php -m<em id="__mceDel"> </em></div>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">
apcu
calendar
Core
ctype
curl
</span><span style="color: rgba(0, 0, 255, 1)">date</span><span style="color: rgba(0, 0, 0, 1)">
dom
exif
FFI
fileinfo
filter
</span><span style="color: rgba(0, 0, 255, 1)">ftp</span><span style="color: rgba(0, 0, 0, 1)">
gd
gettext
hash
iconv
imagick
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
</span><span style="color: rgba(0, 0, 255, 1)">zip</span><span style="color: rgba(0, 0, 0, 1)">
zlib
Zend OPcache</span></pre>
</div>
<p> </p><br><br>
来源:https://www.cnblogs.com/workhelper/p/16211659.html
頁:
[1]