I have a digitalocean droplet that I use for hosting a wordpress blog. I got a message on my Wordpress dashboard that my PHP is outdated and that I should update it to at least PHP 8.3. How to do that?
I’m not proficient in server administration but I can use the command line. Please guide me.
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!
Heya,
PHP 8.3 may not be available in the default Ubuntu repositories, so you’ll need to add the ondrej/php
PPA to get the latest PHP version.
Run the following commands to add the PPA:
sudo add-apt-repository ppa:ondrej/php
sudo apt update
After adding the repository, you can install PHP 8.3 and some common PHP extensions for WordPress. Run the following command:
sudo apt install php8.3 php8.3-cli php8.3-fpm php8.3-mysql php8.3-xml php8.3-mbstring php8.3-curl php8.3-zip
If you’re using PHP-FPM with Nginx, restart the PHP-FPM service to apply the update:
sudo systemctl restart php8.3-fpm
If you already have an older PHP version installed (e.g., PHP 7.x), you can switch between PHP versions using the update-alternatives
command.
To set PHP 8.3 as the default version for your CLI and web server (e.g., Apache or Nginx), run:
sudo update-alternatives --set php /usr/bin/php8.3
sudo update-alternatives --set phpize /usr/bin/phpize8.3
sudo update-alternatives --set php-config /usr/bin/php-config8.3
After updating PHP, restart your web server to make sure it uses the new PHP version.
sudo systemctl restart nginx
Heya, @1ddffddc31ea402a842dcb134f6134
As a side note, you can check which are the currently installed PHP packages for the current PHP version and make sure all these packages will be installed for PHP 8.3 as well
The PHP packages for WordPress are:
sudo apt install php8.3 php8.3-cli php8.3-fpm php8.3-mysql php8.3-curl php8.3-xml php8.3-mbstring php8.3-gd php8.3-zip php8.3-bcmath php8.3-intl -y
Hope that this helps!
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.