我有 digitalocean 服务器,我通过 laravel forge 管理它。服务器配置php7.3就可以了。我想用于一些网站 php5.6 和一些网站 php7.3。所以我想以某种方式在 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 directory in server contains php7.3-fpm.pid and php7.3-fpm.sock.
我认为 php5.6 存在于服务器中,因为/etc/php/5.6 文件夹存在于服务器中。
最佳答案
this答案对我有帮助。
我在服务器上安装了 php5.6 fpm
sudo apt-get install php5.6-fpm
在 laravel forge 中我编辑了这一行 fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;到 fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;在网站nginx配置文件中。
所以 phpinfo 它更改为 php5.6。
关于php - 为某些网站切换 nginx php 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58687628/