linux搭建可切换版本php|如何在linux下安装多个不同版本的PHP

A. 如何在linux下安装多个不同版本的PHP

进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择你需要回的模块,比如答curl模块:cd curl 执行phpize生成编译文件,phpize在PHP安装目录的bin目录下 /usr/local/php5/bin/phpize 运行时,可能会报错:Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.,需要安装autoconf: yum install autoconf(RedHat或者CentOS)、apt-get install autoconf(Ubuntu Linux) /usr/local/php5/bin/php -v 执行这个命令时,php会去检查配置文件是否正确,如果有配置错误,这里会报错,可以根据错误信息去排查!

B. 如何在linux下安装多个不同版本的PHP

Linux下部署php多版本共存背景说明自php7问世,身为最新版本控的我马上升级体验,但是由于服务器上还有旧程序在运行,只好部署一个php多版本共存环境。现有环境是lnmp – CentOS 6.7 – nginx 1.10.1 – mariadb-10.0.26 – php 7.0.8为了更好兼容旧的php程序,推荐使用5.4.45. 主要是兼容mysql扩展。开始安装首先要下载php-5.4.45.tar.gz源码包。通过源码安装# tar xzvf php-5.4.45.tar.gz# cd php-5.4.45# ./configure –prefix=/usr/local/php54 –with-config-file-path=/usr/local/php54/etc –enable-fpm –with-fpm-user=www –with-fpm-group=www –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-iconv-dir –with-freetype-dir=/usr/local/freetype –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –enable-mbregex –enable-mbstring –with-mcrypt –enable-ftp –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –with-gettext –disable-fileinfo –enable-intl –with-xsl# make ZEND_EXTRA_LIBS='-liconv'# make install# cp php.ini-proction /usr/local/php/etc/php.ini————————————————————————————————php.ini 配置post_max_size = 50Mupload_max_filesize = 50Mdate.timezone = PRCshort_open_tag = Oncgi.fix_pathinfo=0max_execution_time = 300disable_functions=passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server————————————————————————————————php-fpm.conf 配置——————————# vim /usr/local/php/etc/php-fpm.conf1[global]pid = /usr/local/php54/var/run/php-fpm.piderror_log = /usr/local/php54/var/log/php-fpm.loglog_level = notice[www]listen = /tmp/php54-cgi.socklisten.backlog = -1listen.allowed_clients = 127.0.0.1:9001listen.owner = wwwlisten.group = wwwlisten.mode = 0666user = wwwgroup = wwwpm = dynamicpm.max_children = 40pm.start_servers = 20pm.min_spare_servers = 20pm.max_spare_servers = 40request_terminate_timeout = 100request_slowlog_timeout = 0slowlog = var/log/slow.log———————————————————————————-启动 php-fpm# cp sapi/fpm/init.d.php-fpm /etc/init.d/php54-fpm# chmod +x /etc/init.d/php54-fpm# /etc/init.d/php54-fpm start——————————————————————————————-修改nginx配置,对需要的服务配置使用php-5.4.45location ~ [^/]\.php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php54-cgi.sock; fastcgi_index index.php; include fastcgi.conf; }—————————————————————————————-配置php-5.4.45 的php54-fpm 开机自动启动# chkconfig –add php54-fpm # chkconfig php54-fpm on

C. 如何在linux下安装phalcon框架php版本的扩展

第一步:在网络中搜索Phalcon,一般第一个网站,进入网站,我们点击网站首页的download,目前该框架的最近版本是2.0


赞 (0)