时间:2021-07-01 10:21:17 帮助过:24人阅读
选择lnmp模式,默认安装php5.4,安装步骤参考:http://oneinstack.com/install/
选项如下:
Install Nginx
Do not install Apache
Do not install Tomcat
Install MySQL-5.6
Install php-5.4
....
service php-fpm stop #后面需要再安装php,需要停止php
mv /etc/init.d/php-fpm{,_bk} #后面需要再安装php会覆盖,备份启动脚本
默认php5.4安装路径是/usr/local/php,如果再次安装会提示php已经安装,因此必须修改options.conf的php安装 目录,将php7安装路径设置为/usr/local/php7,修改/root/oneinstack/options.conf:
php_install_dir=/usr/local/php7
再次执行./install.sh,选择Install php-7,其余均选择n,等待ing
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启动脚本
设置php5.4、php7开机自启动:
# 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
防止php5.4、php7监听sock冲突,修改php7的listen,更改配置文件/usr/local/php7/etc/php-fpm.conf:
listen = /dev/shm/php-cgi.sock
#改成
listen = /dev/shm/php7-cgi.sock
手工启动php5.4、php7:
service php-fpm start #启动php5.4
service php7-fpm start #启动php7
如下图:
./vhost.sh绑定域名,默认是运行在php5.4,如需要将网站运行在php7下,需要修改/usr/local/nginx/conf/vhost/www.oneinstack.com.conf(www.oneinstack.com改成自己绑定域名):
fastcgi_pass unix:/dev/shm/php-cgi.sock;
#改成
fastcgi_pass unix:/dev/shm/php7-cgi.sock;
重新加载nginx,使配置生效:
service nginx reload
转载: