Hello,
I am struggling to update my PHP version on my DigitalOcean droplet. It is currently on 7.0.33 and I would like to update it to PHP 7.4+. The ondrej php upgrade method does not work for me so I tried using the sergey-dryabzhinsky repo. Upon getting the php to successfully upgrade to 7.4, my website loads only a Apache screen and no longer links to the web page.
How can I upgrade my PHP from 7.0.33 to 7.4+ without affecting the WordPress installation? I know there must be a way to do this without impacting any directories or configs. Please advise.
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.
Heya @28aa9846729a44cf9f819481fa1755,
Can you tell us why using the ondrej:php repo does not work? Here is the usual way to upgrade PHP version with Apache.
Step 1: Backup Your Data
Before making any significant changes to your server, it’s essential to back up your data. You can use the snapshot function:
https://docs.digitalocean.com/products/images/snapshots/
It doesn’t matter that you have tried some stuff, just make sure you back up now before you proceeed
Step 2: Update Your System
Log in to your server via SSH and run the following commands to update your package lists and upgrade existing packages:
Step 3: Add PHP 7.4 Repository
You need to add a repository that contains PHP 7.4 packages. The Ondřej Surý PPA is widely used for PHP installations on Ubuntu:
Step 4: Install PHP 7.4
Once the repository is added, you can install PHP 7.4:
Install PHP 7.4 modules that you might need. Commonly used modules include:
Step 5: Disable the Old PHP Version
Disable the old PHP 7.0 version to avoid conflicts:
Step 6: Enable PHP 7.4
Enable PHP 7.4 to make it the default version:
That is it, it’s a straightforward process.
Can you let me know what errors you hit if you follow it?