By quirkymalcom
Hi everyone,
I keep seeing this message on my WordPress dashboard. Your site is running an insecure version of PHP (7.2.24-0ubuntu0.18.04.8), which should be updated.
Can you please tell me how can I upgrade my PHP to the latest version on the Nginx server?
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!
Hello, @quirkymalcom
The first important thing to know is that you won’t be actually upgrading the PHP version but installing the newest one as well.
You’ll need to add the proper repositories
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Next depending on your WebService - Nginx/Apache you have different steps.
Let’s start with the Nginx requirements:
sudo apt install php7.4-fpm
To check this afterwards run
php-fpm7.4 -v
Now that you have the PHP version, you’ll need to install some extensions. You can do it like so
sudo apt install php7.34-extension_name
The most common extensions can be installed with the following command
sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y
Now you should have PHP 7.4 installed. You need to also restart Nginx in order to apply the changes.
Run the configuration test
- nginx -t
Restart the web server
- sudo service nginx restart
Hope that this helps! Regards, Alex
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.