简体   繁体   English

为某些网站切换 nginx php 版本

[英]switch nginx php version for some websites

I have digitalocean server and I manage it by laravel forge.我有 digitalocean 服务器,我通过 laravel forge 管理它。 The server configured with php7.3 an it is ok.服务器配置了php7.3就可以了。 I wanna use for some websites php5.6 and for some websites php7.3.我想用于一些网站 php5.6 和一些网站 php7.3。 So I want somehow switch php version in the nginx configuration.所以我想以某种方式在 nginx 配置中切换 php 版本。

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

I changed this line /var/run/php/php7.3-fpm.sock to var/run/php/php5.6-fpm.sock but no luck.我将此行 /var/run/php/php7.3-fpm.sock 更改为 var/run/php/php5.6-fpm.sock 但没有运气。

/var/run/php directory in server contains php7.3-fpm.pid and php7.3-fpm.sock.服务器中的 /var/run/php 目录包含 php7.3-fpm.pid 和 php7.3-fpm.sock。

and I think that php5.6 exists in the server because /etc/php/5.6 folder exitst in the server.我认为 php5.6 存在于服务器中,因为 /etc/php/5.6 文件夹存在于服务器中。

this answer helped me.这个答案帮助了我。

I installed php5.6 fpm to server我将php5.6 fpm安装到服务器

sudo apt-get install php5.6-fpm

and in laravel forge I edited this line fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;在 laravel forge 我编辑了这一行 fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; to fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;到 fastcgi_pass unix:/var/run/php/php5.6-fpm.sock; in the website nginx configuration file.在网站 nginx 配置文件中。

SO phpinfo it changed to php5.6.所以 phpinfo 它更改为 php5.6。

You need install php-5 on your webserver.您需要在您的网络服务器上安装 php-5。

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update
sudo apt-get install php5.6-fpm

The link php ppa链接php ppa

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM