Updation of PHP

  • Posted on November 15, 2022
  • PHP
  • krAnemoneAsked by kr

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.


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.

Site Moderator
Site Moderator badge
June 19, 2023

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.

  1. Check Your PHP 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 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.

  1. Check Your WordPress 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:

php -v

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:

  1. Add the Ondřej Surý PPA:
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
  1. Install PHP 8.0:

Once the PPA is installed, you can install PHP 8.0:

sudo apt install php8.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:

sudo apt install php8.0-cli php8.0-fpm php8.0-json php8.0-pdo php8.0-mysql php8.0-zip php8.0-gd  php8.0-mbstring php8.0-curl php8.0-xml php8.0-bcmath
  1. Switch to the new PHP version:

If other PHP versions are installed on your system, you need to disable them and enable the PHP 8.0 version. For Apache:

sudo a2dismod php7.4
sudo a2enmod php8.0

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:

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

You’ll want to replace php7.4-fpm.sock with php8.0-fpm.sock to use the new PHP version:

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;

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:

sudo systemctl restart nginx
sudo systemctl restart php8.0-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 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.

Bobby Iliev
Site Moderator
Site Moderator badge
November 15, 2022

Hi there,

Before making any major server upgrades, I would suggest taking a backup of your Droplet:

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:

php -v

If you want to upgrade to a specific version, you could follow the steps from this answer here:

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!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.

This promotional offer applies to new account only.

© 2023 DigitalOcean, LLC.