简体   繁体   English

如何让Nginx使用替代PHP版本?

[英]How to get Nginx to use alternative PHP version?

I have an Ubuntu web server running Nginx. 我有一个运行Nginx的Ubuntu Web服务器。 I was runngin PHP 5.5.30 and I installed PHP 5.6.23 using the following commands: 我运行PHP 5.5.30并使用以下命令安装PHP 5.6.23:

1) sudo apt-add-repository ppa:ondrej/php
2) sudo apt-get update
3) sudo apt-get install php5.6

The installation is under a new path from the previous verison of PHP (/etc/php/5.6/). 安装是从以前的PHP版本(/etc/php/5.6/)开始的。 When I run a phpinfo() command from a web page I still get it running under the old version of PHP (5.5.30) - how do I get Nginx looking at the new installation? 当我从网页运行phpinfo()命令时,我仍然可以在旧版本的PHP(5.5.30)下运行它 - 如何让Nginx查看新安装?

ps When I run php --version from the command line it show PHP 5.6.23 ! ps当我从命令行运行php --version时,它显示PHP 5.6.23! pps My nginx.conf file contains fastcgi_pass unix:/run/php/php5.6-fpm.sock; pps我的nginx.conf文件包含fastcgi_pass unix:/run/php/php5.6-fpm.sock;

I have the same problem. 我也有同样的问题。 You forgot to change the default sockets from fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; 你忘了从fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;更改默认套接字fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; to fastcgi_pass unix:/var/run/php/php5.6-fpm.sock; to fastcgi_pass unix:/var/run/php/php5.6-fpm.sock; - you can find the configuration file at /etc/nginx/sites-available/default . - 您可以在/etc/nginx/sites-available/default找到配置文件。

Before: 之前:

fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;

After: 后:

fastcgi_pass unix:/run/php/php5.6-fpm.sock;

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

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