Dear Hosting Provider,
I would like to verify if my hosting account is running PHP 7.4 or newer, and if I’m also running the latest version of WordPress. If I am not already on the latest version of PHP or WP, please let me know what steps I need to take to update.
Thanks!
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!
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.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.
This promotional offer applies to new account only.
Heya, all
In case anyone stumbles upon this topic here are some common ways to start the update processes
let’s break this into two parts: checking your PHP version and then checking your WordPress version.
You can check your PHP version by creating a simple PHP info page. Create a new PHP file (e.g.,
info.php
) in your website’s root directory with the following content:phpCopy code
<?php phpinfo(); ?>
After you’ve created this file, navigate to
http://yourwebsite.com/info.php
in your web browser. You should see a page that displays information about your PHP configuration, including the version number.Remember to delete the
info.php
file once you’ve confirmed your PHP version, as it contains sensitive information about your server’s configuration.Alternatively, if you have SSH access to your server, you can log in and execute the command
php -v
to check the PHP version.To check your WordPress version, log into your WordPress admin dashboard. The version number will be displayed in the bottom right corner of the admin dashboard.
You can also check the WordPress version by opening the
version.php
file located in the/wp-includes/
directory. The version number will be defined in the$wp_version
variable.Update PHP
First, check your current PHP version:
To check your current PHP version, log into your server via SSH, and type the following command:
This will display your current PHP version.
If your PHP version is 7.4 or older, here’s how you can upgrade to PHP 8.0:
Once the PPA is installed, you can install PHP 8.0:
You should also install commonly used PHP 8.0 extensions. The command to do so will depend on the extensions you need, but it might look something like this:
If other PHP versions are installed on your system, you need to disable them and enable the PHP 8.0 version. For Apache:
Note: Replace “7.4” with your current version of PHP if it’s different.
Restart Apache and you are good to go For Nginx 1. Install PHP 8.0 and PHP-FPM:
First, make sure you’ve installed PHP 8.0 and PHP-FPM as mentioned in the previous message.
2. Update the Nginx Configuration:
Next, you’ll need to update your Nginx configuration to use PHP 8.0. The configuration file might be located at
/etc/nginx/sites-available/default
, or it might be in a different location depending on your setup.Find the block of code that looks like this:
You’ll want to replace
php7.4-fpm.sock
withphp8.0-fpm.sock
to use the new PHP version:This tells Nginx to process PHP files using PHP 8.0.
3. Restart Nginx and PHP-FPM:
To apply the changes, you’ll need to restart Nginx and PHP-FPM:
Update WordPress
Before updating WordPress, take a backup of your website. You can update WordPress from the Dashboard > Updates menu in WordPress. Click on the “Update Now” button to upgrade. It’s also a good practice to keep your themes and plugins up-to-date.
If there is no update option, it might mean that automatic updates are disabled in your WordPress configuration, or your web host has blocked this feature. In that case, you could manually update WordPress by downloading the latest version from wordpress.org and replacing the core files via FTP. Please remember that the wp-content folder is not to be replaced as it contains your theme and plugins.
Hi there,
Before making any major server upgrades, I would suggest taking a backup of your Droplet:
https://docs.digitalocean.com/products/images/backups/
That way if something goes wrong during the upgrade, you can revert to a working version.
After that you can check your PHP version by running the following command:
If you want to upgrade to a specific version, you could follow the steps from this answer here:
https://www.digitalocean.com/community/questions/how-to-upgrade-php-version-from-7-2-to-php-7-3-in-ubuntu-16-04
The example is with PHP 7.3 but will also work with newer versions.
For your WordPress version, you can check that directly via your WordPress admin dashboard at
/wp-admin
.Hope that this helps!
Best,
Bobby