Skip to content

Instantly share code, notes, and snippets.

@budiantoip
Last active December 23, 2024 06:08
Show Gist options
  • Save budiantoip/1f76a7bd49dd01c4ff11852c84849b48 to your computer and use it in GitHub Desktop.
Save budiantoip/1f76a7bd49dd01c4ff11852c84849b48 to your computer and use it in GitHub Desktop.
How to install Older PHP Versions on Ubuntu

Add ondrej/php repository

sudo add-apt-repository ppa:ondrej/php

Update apt metadata

sudo apt update

For example, install php v7.4

sudo apt install php7.4 php7.4-cli php7.4-fpm

Install php extensions

sudo apt install php7.4 php7.4-cli php7.4-fpm php7.4-{mysql,curl,json,xsl,gd,xml,zip,xsl,soap,bcmath,mbstring,common,bz2,gmp,igbinary,imagick,imap,intl,ldap,sqlite3,tidy}

Check installed PHP version

php -v

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment