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