linux 系统下安装多个php版本

思路:

  下载不同的php源码包,解压后安装在不同的目录下,修改php-fpm监听的端口号

 

php安装配置参数:

./configure --prefix=/usr/local/php71 --exec-prefix=/usr/local/php71 --bindir=/usr/local/php71/bin --sbindir=/usr/local/php71/sbin --includedir=/usr/local/php71/include --libdir=/usr/local/php71/lib/php --mandir=/usr/local/php71/php/man --with-config-file-path=/usr/local/php71/etc --with-mcrypt=/usr/local/libmcrypt --with-mhash --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-gd --with-iconv --with-zlib --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-fpm --without-gdbm --disable-fileinfo --enable-opcache=no

 

make && make install

 

运行 /usr/local/php71/sbin/php-fpm 报错如下:

原因:php-fpm.conf 文件不存在

解决:

 

 

修改www.conf文件,修改php-fpm监听的端口号 改为9001

 

启动php-fpm,结果如下,成功了,系统运行了两个版本的php

 

最后,可以将新版本的php加入开机自启动,修改 /etc/rc.local文件,加入php-fpm的运行路径即可

 

 

posted @ 2019-04-17 10:59  七彩鱼丸  阅读(5627)  评论(0编辑  收藏  举报