An update to the droplet PHP has worked but wordpress still has lower version.

Posted January 18, 2021 635 views

Hey All,

My PHP version according to the console is:

PHP 7.3.26 (cli) (built: Jan 5 2021 16:37:31) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.3.26, Copyright © 1998-2018 Zend Technologies
with Zend OPcache v7.3.26, Copyright © 1999-2018, by Zend Technologies

But in Wordpress it says:
Server info: Apache/2.4.46 (Unix) OpenSSL/1.0.2g
PHP version: 7.0.33 - We recommend using PHP version 7.2 or above for greater performance and security.

How do I get it to register the correct version?

I’m using Ubuntu 16.04.7 LTS (GNU/Linux 4.4.0-200-generic x86_64).

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @tom57746c21d00f ,

You need to tell Apache/Nginx to use the newly installed PHP verson.


You need to tell Apache to use the installed version of PHP 7.3 by disabling the old PHP module and enabling the new PHP module using the following command.

sudo a2dismod php5.X
sudo a2enmod php7.3

Remember to change 5.X with your actual PHP version.

Restart Apache for the changes to take effect.

sudo service apache2 restart


For Nginx you need to install FPM, execute the following command to install PHP 7.3 FPM

sudo apt install php7.3-fpm

After the installation has completed, confirm that PHP 7.3 FPM has installed correctly with this command

php-fpm7.3 -v

For Nginx you need to update the PHP-FPM socket in your Nginx configuration located inside the sites-available directory. This will be located inside the location block location ~ \.php$

sudo nano /etc/nginx/sites-available/your.conf

The line you need to modify will look like this…

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

You need to replace the old PHP version with the new version.

fastcgi_pass unix:/run/php/php7.3-fpm.sock; 


  • Hi @KFSys,

    Thanks for the reply. Unfortunately, I get the messages:

    sudo: a2dismod: command not found
    sudo: a2enmod: command not found
    Failed to restart apache2.service: Unit apache2.service not found.


    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    E: Unable to locate package php7.3-fpm
    E: Couldn't find any package by glob 'php7.3-fpm'
    E: Couldn't find any package by regex 'php7.3-fpm'
    • Ok @KFSys, turns out it’s an old serverpilot droplet so it does actually have all the versions of PHP installed. I can see the folders using filezilla. I can also see my wordpress installation.

      So the trick now is to get it to use the new PHP version?

      • Hi @tom57746c21d00f,

        Well, that’s good to hear.

        As for starting to use the new PHP version, you need to update the PHP-FPM socket in your Nginx configuration located inside the sites-available directory.

        sudo nano /etc/nginx/sites-available/default

        Find the block

        location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.0-fpm.sock; ---- Remove this line by commenting '#'
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;

        Save the file, exit, and execute

        sudo nginx -t
        sudo systemctl reload nginx