Switch one-click-LAMP droplet to PHP v7.2

I created the droplet using the “Create LAMP droplet” button on My website is old, was created with PHP7.2, and delivers a blank screen with my new droplet. I assume that it will not run on PHP8. What do I need to do to get the droplet using PHP7.2?

Show comments

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
July 9, 2024


In order to use PHP 7.2, you’ll need to install it and then switch to that PHP version so that Apache knows which one to use.

PHP 7.2 is not included in the default Ubuntu repositories for newer versions of Ubuntu. You need to add the repository maintained by Ondřej Surý, which includes PHP 7.2.

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

Now you can install PHP 7.2 and the necessary modules.

sudo apt-get install php7.2 php7.2-cli php7.2-fpm php7.2-mysql php7.2-xml php7.2-curl php7.2-gd php7.2-mbstring php7.2-zip php7.2-soap php7.2-intl

You need to disable the current PHP module for Apache and enable the PHP 7.2 module.

sudo a2dismod php8.0
sudo a2enmod php7.2

Finally, restart the Apache server to apply the changes.

sudo systemctl restart apache2

Try DigitalOcean for free

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

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

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

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

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