简体   繁体   中英

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.

I have run commands to set alternatives and tried a couple of other solutions I found on the web to no avail.

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.

First, try to update your ubuntu version. Ubuntu 18.04 is a stable version. 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.
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.

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!

I just had to modify the appropriate one. This took me weeks to do. Damn!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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