Oneinstack Implementation of PHP Multi-version Coexistence tutorial

Source: Internet
Author: User
Tags fpm install php

1. Install Oneinstack

Select LNMP mode, default installation php5.4, installation steps reference: http://oneinstack.com/install/
The options are as follows:

Install Nginx
Do not install Apache
Do not install Tomcat
Install MySQL-5.6
Install php-5.4
....

2. Install PHP7

Service PHP-FPM stop #后面需要再安装php, need to stop PHP
MV/ETC/INIT.D/PHP-FPM{,_BK} #后面需要再安装php会覆盖, backup startup script
The default php5.4 installation path is/usr/local/php, and if you install again prompts PHP to install, you must modify the options.conf PHP installation directory, set the PHP7 installation path to/USR/LOCAL/PHP7, and modify the/root/ Oneinstack/options.conf:
Php_install_dir=/usr/local/php7
Execute again./install.sh, select Install Php-7, and all the rest select N and wait for ing

3. Modify PHP configuration file

Service PHP-FPM Stop #停止php7启动脚本
MV/ETC/INIT.D/PHP-FPM/ETC/INIT.D/PHP7-FPM #重命名php7启动脚本
MV/ETC/INIT.D/PHP-FPM_BK/ETC/INIT.D/PHP-FPM #恢复php5.4 Startup scripts
Set php5.4, PHP7 boot from:
# CentOS:
Chkconfig--add PHP7-FPM
Chkconfig--add PHP-FPM
Chkconfig PHP7-FPM on
Chkconfig PHP-FPM on
# Ubuntu/debian:
UPDATE-RC.D PHP7-FPM Defaults
UPDATE-RC.D PHP-FPM Defaults
Prevents php5.4, PHP7 from monitoring sock conflicts, modifies PHP7 listen, and changes the configuration file/usr/local/php7/etc/php-fpm.conf:
Listen =/dev/shm/php-cgi.sock
#改成
Listen =/dev/shm/php7-cgi.sock
Manually start php5.4, PHP7:
Service php-fpm start #启动php5.4
Service PHP7-FPM Start #启动php7

4. Modify the Nginx virtual host configuration file

/vhost.sh bound domain name, default is run in php5.4, if need to run the website under PHP7, need to modify/usr/local/nginx/conf/vhost/ Www.oneinstack.com.conf (www.oneinstack.com to its own bound domain name):
Fastcgi_pass Unix:/dev/shm/php-cgi.sock;
#改成
Fastcgi_pass Unix:/dev/shm/php7-cgi.sock;
Reload the Nginx so that the configuration takes effect:
Service Nginx Reload

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.