15158846557 在线咨询 在线咨询
15158846557 在线咨询
所在位置: 首页 > 营销资讯 > 网站运营 > 如何使php5.4 , php 5.6, php7 环境 在一台服务器上共存?

如何使php5.4 , php 5.6, php7 环境 在一台服务器上共存?

时间:2023-11-05 03:06:01 | 来源:网站运营

时间:2023-11-05 03:06:01 来源:网站运营

如何使php5.4 , php 5.6, php7 环境 在一台服务器上共存?:把不同版本的PHP编译安装到不同目录就行,比如:

./configure --prefix=/opt/php/5.6./configure --prefix=/opt/php/7.1configure生成的PHP-FPM服务管理脚本php-src/sapi/fpm/init.d.php-fpm会去用prefix里的配置去运行PHP-FPM:

prefix=/opt/php/7.1exec_prefix=${prefix}php_fpm_BIN=${exec_prefix}/sbin/php-fpmphp_fpm_CONF=${prefix}/etc/php-fpm.confphp_fpm_PID=${prefix}/var/run/php-fpm.pid可以给不同版本的PHP-FPM进行不同的配置,比如配置使用不同的端口.

Debian/Ubuntu/Deepin上编译PHP可以参考如下步骤:

# 安装编译PHP依赖的开发包sudo apt-get install /build-essential /autoconf /libtool /bison /re2c /zlib1g-dev /libbz2-dev /libwebp-dev /libjpeg-dev /libpng12-dev /libxpm-dev /libfreetype6-dev /libxml2-dev /libxslt1-dev /libpcre3-dev /libenchant-dev /libpspell-dev /libaspell-dev /libssl-dev /libmcrypt-dev /libgmp-dev /libcurl4-openssl-dev /libldap2-dev /libsasl2-dev /libc-client2007e-dev /libkrb5-dev /libgettextpo-dev /libtidy-dev /libreadline6-dev /libicu-dev /libpq-dev /firebird-dev /librecode-dev /libsnmp-dev /libt1-dev /libxt-dev /libmysqlclient-dev# 软链接一些库和头文件到指定目录,否则PHP的configure会提示找不到sudo ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/sudo ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/sudo ln -s /usr/lib/x86_64-linux-gnu/libXpm.so /usr/lib/sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/# 执行configure脚本./configure /--prefix=/opt/php/7.1 /--with-sqlite3=shared /--with-pdo-sqlite=shared /--with-mysql=mysqlnd /--with-mysqli=mysqlnd /--with-pdo-mysql=mysqlnd /--with-pgsql=shared,/usr/bin/pg_config /--with-pdo-pgsql=shared,/usr/bin/pg_config /--enable-posix /--enable-pcntl /--enable-shmop /--enable-sysvshm /--enable-sysvsem /--enable-sysvmsg /--enable-phar /--enable-zip /--with-zlib /--with-zlib-dir=/usr /--with-bz2=shared /--with-gd=shared /--enable-gd-native-ttf /--enable-gd-jis-conv /--with-webp-dir=/usr /--with-jpeg-dir=/usr /--with-png-dir=/usr /--with-xpm-dir=/usr /--with-freetype-dir=/usr /--enable-exif=shared /--enable-json /--enable-libxml /--with-libxml-dir=/usr /--enable-xml /--enable-xmlreader /--enable-xmlwriter /--enable-simplexml /--with-pear /--with-xsl=shared /--enable-dom /--enable-soap=shared /--enable-wddx=shared /--with-xmlrpc=shared /--enable-ctype /--enable-filter /--with-pcre-regex /--with-pcre-jit /--with-enchant=shared /--with-pspell=shared /--enable-fileinfo=shared /--enable-intl=shared /--with-icu-dir=/usr /--enable-mbstring=shared /--with-iconv /--enable-hash /--with-openssl=shared /--with-mcrypt=shared /--enable-bcmath /--with-gmp=shared /--enable-session /--enable-sockets /--enable-ftp /--with-curl=shared /--with-snmp=shared /--with-ldap=shared /--with-ldap-sasl /--with-imap=shared /--with-kerberos /--with-imap-ssl /--enable-calendar /--with-gettext=shared /--with-tidy=shared /--with-readline /--enable-tokenizer /--enable-opcache /--enable-cli /--enable-cgi /--enable-fpm /--enable-phpdbg /--enable-phpdbg-webhelper# 开启2个任务进行编译time make -j2# 安装PHP到/opt/php/7.1sudo make install

关键词:服务,共存,环境

74
73
25
news

版权所有© 亿企邦 1997-2025 保留一切法律许可权利。

为了最佳展示效果,本站不支持IE9及以下版本的浏览器,建议您使用谷歌Chrome浏览器。 点击下载Chrome浏览器
关闭