我使用 nginx 在 ubuntu16.04 上将 PHP 从 7.0.27 版升级到 7.2 版。
当我在终端上运行 php -v 时,我可以看到:
PHP 7.2.2-3+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Feb 6 2018 16:11:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.2-3+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
Run Code Online (Sandbox Code Playgroud)
但是当我在浏览器中看到回显 phpinfo() 时,它显示了旧版本的 PHP,例如:
PHP Version 7.0.27-1+ubuntu16.04.1+deb.sury.org+1
Run Code Online (Sandbox Code Playgroud)
这意味着 nginx 没有使用 PHP7.2,我需要为此进行配置。请,任何帮助表示赞赏。
提前致谢。
为了增加 Thomas 的回答,这是您需要更改的文件:
sudo nano /etc/nginx/sites-available/default
Run Code Online (Sandbox Code Playgroud)
或者如果您在一个 nginx 上运行多个站点:
sudo nano /etc/nginx/sites-available/your_site_name
Run Code Online (Sandbox Code Playgroud)
改变这部分
server {
...
location ~ \.php$ {
...
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
...
}
Run Code Online (Sandbox Code Playgroud)
php7.0-fpm.sock
到 php7.2-fpm.sock
归档时间: |
|
查看次数: |
7882 次 |
最近记录: |