简体   繁体   English

Phpinfo() 在 NginX 更新后显示旧的 PHP 版本

[英]Phpinfo() shows old PHP version after update on NginX

After updating the PHP version on my digital ocean droplet running on Ubuntu 16.04, the PHP version my web server uses is still stuck on 5.6. After updating the PHP version on my digital ocean droplet running on Ubuntu 16.04, the PHP version my web server uses is still stuck on 5.6.

I have run commands to set alternatives and tried a couple of other solutions I found on the web to no avail.我已经运行命令来设置替代方案,并尝试了我在 web 上找到的其他几个解决方案,但均无济于事。

The PHP version on the CLI is updated to 7.4, but that of the webserver won't bulge and I can't tell why. CLI 上的 PHP 版本已更新到 7.4,但网络服务器的版本不会膨胀,我不知道为什么。

First, try to update your ubuntu version.首先,尝试更新您的 ubuntu 版本。 Ubuntu 18.04 is a stable version. Ubuntu 18.04 是稳定版本。 After that execute these commands.之后执行这些命令。

  1. apt install software-properties-common
  2. add-apt-repository ppa:ondrej/php
  3. apt update && apt-get install php7.4-fpm
    After that you have to add these lines into nginx config file.之后,您必须将这些行添加到 nginx 配置文件中。
location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
  }

Turns out I was modifying the general conf file available at: /etc/nginx/sites-available/default to use PHP7.4, rather than the specific one for the website I was working on.原来我正在修改通用 conf 文件:/etc/nginx/sites-available/default 以使用 PHP7.4,而不是我正在处理的网站的特定文件。

I did an ls command on the /etc/nginx/sites-available/ directory that showed I had different files for all the websites there and that was it!我在 /etc/nginx/sites-available/ 目录上执行了 ls 命令,显示我对那里的所有网站都有不同的文件,就是这样!

I just had to modify the appropriate one.我只需要修改适当的。 This took me weeks to do.这花了我几个星期才完成。 Damn!该死!

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

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