Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use OneinStack to achieve the coexistence of multiple versions of PHP

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article analyzes "how to use OneinStack to achieve the coexistence of multiple versions of PHP". The content is detailed and easy to understand. Friends who are interested in "how to use OneinStack to achieve multi-version PHP coexistence" can follow the editor's train of thought to read it in depth. I hope it will be helpful to everyone after reading. Let's learn more about "how to use OneinStack to achieve the coexistence of multiple versions of PHP".

If you have two sets of php programs, one is based on php2.3 and the other is based on php3.0, and the two programs need to be online at the same time, you can install multiple apache, but there is a problem of port conflict. If you use different ports, the domain name needs to take port number, so how to achieve the coexistence of multiple versions of PHP?

1. Install OneinStack

Select lnmp mode. Install php5.4 by default. For installation steps, please see: http://oneinstack.com/install/ options are as follows:

Install NginxDo not install ApacheDo not install TomcatInstall MySQL-5.6Install php-5.4....2, install php7service php-fpm stop # need to install php again, need to stop phpmv / etc/init.d/php-fpm {, _ bk} # and then install php will overwrite and back up the startup script

The default php5.4 installation path is / usr/local/php. If you install it again, it will prompt you that php has been installed, so you must modify the php installation directory of options.conf, set the php7 installation path to / usr/local/php7, and modify / root/oneinstack/options.conf:

Php_install_dir=/usr/local/php7

Execute. / install.sh again, select Install php-7, and select n for the rest

3. Modify php configuration file service php-fpm stop # stop php7 startup script mv / etc/init.d/php-fpm / etc/init.d/php7-fpm # rename php7 startup script mv / etc/init.d/php-fpm_bk / etc/init.d/php-fpm # restore php5.4 startup script

Set php5.4 and php7 to boot automatically:

CentOS:

Chkconfig-add php7-fpmchkconfig-add php-fpmchkconfig php7-fpm onchkconfig php-fpm on

Ubuntu/Debian:

Update-rc.d php7-fpm defaultsupdate-rc.d php-fpm defaults

Prevent php5.4 and php7 from listening for sock conflicts, modify php7's listen, and change configuration file / usr/local/php7/etc/php-fpm.conf:

Listen = / dev/shm/php-cgi.sock # before modification listen = / dev/shm/php7-cgi.sock # after modification

Start php5.4 and php7 manually:

Service php-fpm start # start php5.4service php7-fpm start # start php7

As shown below:

4. Modify nginx virtual host configuration file

. / vhost.sh binds the domain name. By default, it runs in php5.4. If you need to run the website under php7, you need to modify / usr/local/nginx/conf/vhost/www.oneinstack.com.conf (change www.oneinstack.com to bind your own domain name):

Fastcgi_pass unix:/dev/shm/php-cgi.sock; # before modification fastcgi_pass unix:/dev/shm/php7-cgi.sock; # after modification

Reload nginx to make the configuration effective:

Service nginx reload on how to use OneinStack to achieve multi-version PHP coexistence to share here, I hope that the above content can make you improve. If you want to learn more knowledge, please pay more attention to the editor's updates. Thank you for following the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report