VOOZH about

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

⇱ How To Install PHP 7.4 and Set Up a Local Development Environment on Ubuntu 18.04 | DigitalOcean


How To Install PHP 7.4 and Set Up a Local Development Environment on Ubuntu 18.04

Published on March 31, 2021
Not using Ubuntu 18.04?
Choose a different version or distribution.
Ubuntu 18.04
πŸ‘ How To Install PHP 7.4 and Set Up a Local Development Environment on Ubuntu 18.04

The author selected Open Sourcing Mental Illness Ltd to receive a donation as part of the Write for DOnations program.

Introduction

PHP is a popular server scripting language known for creating dynamic and interactive web pages. Getting up and running with your language of choice is the first step in learning to program.

This tutorial will guide you through installing PHP 7.4 on Ubuntu and setting up a local programming environment via the command line. You will also install a dependency manager, Composer, and test your installation by running a script.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author

Committed to helping software developers to be successful by solving challenges in both their careers and their parenting.

Still looking for an answer?

Was this helpful?

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!

I followed all the instructions but my apache seems to still be pointing/using php 7.2 (That is what my wordpress dashboard says) even though php -v on the command line gives me 7.4 as a result. What can I do to make apache use the latest php version?

This recepie no longer works. Apparetnly, ondrej has deleted the required files. Following this tutorial now returns the following error:

root@MySites:~# sudo apt -y install php7.4

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package php7.4

E: Couldn't find any package by glob 'php7.4'

E: Couldn't find any package by regex 'php7.4'

I have also run into issues with this being out of date, ondrej/php does not now support ubuntu 18.04 - also I am unable to update ubuntu due to security clashes with php7.2.

πŸ‘ Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

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 AI-native businesses

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.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Β© 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.