Question

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

I created the droplet using the “Create LAMP droplet” button on https://marketplace.digitalocean.com/apps/lamp#getting-started. 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.

KFSys
Site Moderator
Site Moderator badge
July 9, 2024

Heya,

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

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

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

*This promotional offer applies to new accounts only.