linux如何安装多个php
2022-12-02 09:01:16
115
{{single.collect_count}}

linux安装多个php的方法:首先下载不同的php源码包,并解压安装在不同的目录下;然后修改“php-fpm”监听的端口号;接着修改php安装配置参数;最后启动“php-fpm”即可。

Linux系统运维及项目正式上线:进入学习

推荐:《PHP视频教程

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的运行路径即可

以上就是linux如何安装多个php的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}