系统:centos 6.8 x64
lnmp 使用的军哥的脚本装的,自带php装的5.6
现在我们来给加上php7 以后的 多个版本,并保证 多版本共存
#centos 7 使用扩展源 rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm #centos 6 使用扩展源 rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-6.rpm #php73 yum --enablerepo=remi-safe install -y php73 php73-php-fpm php73-php-mysqlnd php73-php-pecl-mysql php73-php-pecl-redis php73-php-phpiredis. php73-php-mbstring.x86_64 php73-php-pecl-memcache* php73-php-cli php73-build php73-php-pecl-swoole4 php73-php-pecl-mongodb php73-php-pecl-http-devel php73-php-pecl-event php73-php-pear php73-php-devel php73-php-process php73-php-gd php73-php-bcmath #php72 yum --enablerepo=remi-safe install -y php72 php72-php-fpm php72-php-mysql php72-php-pecl-mysql php72-php-pecl-redis php72-php-phpiredis php72-php-mbstring.x86_64 php72-php-pecl-memcache* php72-php-cli php72-build php72-php-pecl-swoole4 php72-php-pecl-mongodb php72-php-pecl-http-devel php72-php-pecl-event php72-php-pear php72-php-devel php72-php-process php72-php-gd php72-php-bcmath #php71 yum --enablerepo=remi-safe install -y php71 php71-php-fpm php71-php-mysql php71-php-pecl-mysql php71-php-pecl-redis php71-php-phpiredis php71-php-mbstring.x86_64 php71-php-pecl-memcache* php71-php-cli php71-build php71-php-pecl-swoole4 php71-php-pecl-mongodb php71-php-pecl-http-devel php71-php-pecl-event php71-php-pear php71-php-devel php71-php-process php71-php-gd php71-php-bcmath #php70 yum --enablerepo=remi-safe install -y php70 php70-php-fpm php70-php-mysql php70-php-pecl-mysql php70-php-pecl-redis php70-php-phpiredis php70-php-mbstring.x86_64 php70-php-pecl-memcache* php70-php-cli php70-build php70-php-pecl-swoole4 php70-php-pecl-mongodb php70-php-pecl-http-devel php70-php-pecl-event php70-php-pear php70-php-devel php70-php-process php70-php-gd php70-php-bcmath
注意,我这把系统都是用的64位系统,32为位系统的包名不一样,
环境安装完毕之后,
需要修改每个版本的配置文件
以 php7.3为例:
1、修改php.ini 添加 disable_functions
vim /etc/opt/remi/php73/php.ini”
/disable_fun
找到此项后 dd 删除此行,并新增
disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru
2、修改php-fpm 配置文件
vim /etc/opt/remi/php73/php-fpm.d/www.conf
/listen
listen = 127.0.0.1:9000
修改监听端口为
listen = 127.0.0.1:9073
修改运行用户和组(默认的是apache,我们需要更改为www)
user = apache
group = apache
改为:
user = www
group = www
3、设置php-fpm自启动
chkconfig php73-php-fpm on
4、启动php-fpm
service php73-php-fpm start
注: 上面标红 数字可以根据所需要安装的版本进行替换,如php7.0 就将数字改为70;