Debian安装PHP8.1
更新 Debian 系统
apt update
apt upgrade -y
安装必要的依赖包
apt-get install ca-certificates apt-transport-https software-properties-common wget curl lsb-release -y
下载安装 Ondřej Surý PHP 仓库的GPG密钥并导入
curl -sSL https://packages.sury.org/php/README.txt | bash -x
再次更新 Debian 源:
apt update
apt upgrade
安装PHP8.1及相关包:
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
Creating config file /etc/php/8.1/fpm/php.ini with new version Created symlink /etc/systemd/system/multi-user.target.wants/php8.1-fpm.service → /lib/systemd/system/php8.1-fpm.service.
启动:
service php8.1-fpm start
查看当前运行状态:
systemctl status php8.1-fpm
● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2022-04-30 23:06:27 CST; 10h ago Docs: man:php-fpm8.1(8) Process: 864 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/8.1/fpm/pool.d/www.conf 81 (code=exited, status=0/SUCCESS) Main PID: 650 (php-fpm8.1) Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec" Tasks: 3 (limit: 2242) Memory: 36.1M CPU: 1.167s CGroup: /system.slice/php8.1-fpm.service ├─650 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf) ├─862 php-fpm: pool www └─863 php-fpm: pool www Apr 30 23:06:26 iZrv8fu4iejmpkZ systemd[1]: Starting The PHP 8.1 FastCGI Process Manager... Apr 30 23:06:27 iZrv8fu4iejmpkZ systemd[1]: Started The PHP 8.1 FastCGI Process Manager.
查看当前版本:
php -v
PHP 8.1.5 (cli) (built: Apr 22 2022 04:56:05) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.5, Copyright (c) Zend Technologies with Zend OPcache v8.1.5, Copyright (c), by Zend Technologies
查看已加载的模块:
php -m
[PHP Modules] apcu calendar Core ctype curl date dom exif FFI fileinfo filter ftp 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 zip zlib [Zend Modules] Zend OPcache