Question

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

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).


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @tom57746c21d00f ,

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

Apache

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

Nginx

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; 

Regards, KFSys