Deploying PHP Multi-version coexistence under Linux

Source: Internet
Author: User
Deploying PHP Multi-version coexistence under Linux

    • Deploying PHP Multi-version coexistence under Linux
      • Background notes
      • Start installation
      • Phpini Configuration
      • php-fpmconf Configuration
      • Start PHP-FPM
      • Modify Nginx configuration to use php-5445 for required service configuration
      • Configuring the php-5445 PHP54-FPM boot automatically

Background notes

Since the advent of PHP7, as the latest version of the control I immediately upgrade experience, but because the server also has the old program is running, had to deploy a PHP multi-version coexistence environment.

The existing environment is LNMP
-CentOS 6.7
-Nginx 1.10.1
-mariadb-10.0.26
-PHP 7.0.8

For better compatibility with older PHP programs, it is recommended to use 5.4.45. is primarily compatible with MySQL extensions.

Start installation

First, download the php-5.4.45.tar.gz source package.

Install via source

#TarXZVFPHP-5.4. $.Tar.GZ#CDPHP-5.4. $#./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# Makezend_extra_libs= '-Liconv '# MakeInstall#CPPHP.INI-Production/usr/local/php/etc/php.INI

PHP.ini Configuration

5050Mdate.timezone = PRCshort_open_tag = Oncgi.fix_pathinfo=0300disable_functi>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 Configuration

# vim /usr/local/php/etc/php-fpm.conf
[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.allowed127.0.0.1:9001listen.owner = wwwlisten.group = wwwlisten.mode0666user = wwwgroup = wwwpm = dynamicpm.max40pm.start20pm.min20pm.max401000slowlog = var/log/slow.log

Note: The focus is on configuring the listening ports and processes

Start 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

Modify the Nginx configuration to use php-5.4.45 for the required service configuration

  location ~ [^/]\.php(/|$)  {      $uri =404;      fastcgi_pass  unix:/tmp/php54-cgi.sock;      fastcgi_index index.php;      include fastcgi.conf;  }

Configuring the php-5.4.45 PHP54-FPM boot automatically

# chkconfig --add php54-fpm# chkconfig php54-fpm on

Chkconfig function Description: Check, set the various services of the system.
Syntax: chkconfig [–add][–del][–list][system service]
Chkconfig [–level] [ <等级代号> system services][on/off/reset]

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the deployment of PHP multi-version coexistence, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.