Question

Need to install php.7.4 on Ubuntu 18. Can't get it in my list to update.

I have tried several methods, even used this tutorial:

https://www.digitalocean.com/community/tutorials/how-to-install-php-7-4-and-set-up-a-local-development-environment-on-ubuntu-18-04

But I can’t get any version above 7.3 is the list.

The following are the repos that have been added:

Hit:1 http://mirrors.digitalocean.com/ubuntu bionic InRelease
Hit:2 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease
Hit:3 https://repos.insights.digitalocean.com/apt/do-agent main InRelease
Hit:4 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease
Hit:5 http://software.virtualmin.com/vm/6/gpl/apt virtualmin-bionic InRelease
Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:7 http://software.virtualmin.com/vm/6/gpl/apt virtualmin-universal InRelease
Hit:8 http://ppa.launchpad.net/ondrej/apache2/ubuntu bionic InRelease
Hit:9 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease

What am I doing wrong?

Thanks


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
November 25, 2023

Heya,

Since PHP 7.4 might not be available in the default Ubuntu 18.04 repositories, you can add a third-party repository that has the package.

sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Now you can install PHP 7.4 along with some common extensions that you might need.

sudo apt install php7.4

If you need additional extensions, you can install them using apt. For example, to install MySQL and GD extensions:

sudo apt install php7.4-mysql php7.4-gd

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