CentOS7安装PHP7
下载程序包
https://www.php.net/downloads
1
| wget https://www.php.net/distributions/php-7.4.26.tar.gz
|
1
| tar zxf php-7.4.26.tar.gz
|
编译安装
1
| ./configure --prefix=/data/servers/php7-4 --with-curl --enable-gd --with-gettext --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-inline-optimization --enable-mbregex --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml
|
配置
1 2 3 4 5 6
| 在源码包目录 cd /data/app/php-7.4.26 cp /data/app/php7-4/php.ini-production /etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm
|
1 2 3 4 5 6 7 8 9 10 11 12 13
| # 进入安装目录 cd /data/servers/php7-4
# 检验php版本 bin/php -v
PHP 7.4.26 (cli) (built: Nov 22 2021 14:49:19) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies
cp etc/php-fpm.conf.default etc/php-fpm.conf cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
|
启动php-fpm
1 2 3
| service php-fpm start
service php-fpm status
|