Skip to content

Instantly share code, notes, and snippets.

@aliharis
Last active October 26, 2023 11:14
Show Gist options
  • Save aliharis/56614bbd952ad889bad056c1e079a8bf to your computer and use it in GitHub Desktop.
Save aliharis/56614bbd952ad889bad056c1e079a8bf to your computer and use it in GitHub Desktop.
Installing PHP 8.1 on Ubuntu 20.04
# PHP 8.1
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get -y install php8.1-cli
# Composer
cd ~
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
sudo mv composer.phar /usr/local/bin/composer
rm composer-setup.php
# Postgresql
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql postgresql-contrib libpq-dev pgadmin3
sudo apt-get -y install php8.1-pgsql
# MySQL
sudo apt-get -y install mysql-server
# Additional extensions
sudo apt -y install php8.1-fpm php8.1-curl php8.1-zip php8.1-mbstring php8.1-xml php8.1-gd php8.1-mysql
# Additional Softwares
sudo apt -y install nodejs npm zip unzip imagemagick php-imagick
@rockymontana
Copy link

rockymontana commented Mar 11, 2020

This doesn't seem to work on 18.10. At least not anymore.

image

@aliharis
Copy link
Author

aliharis commented Apr 6, 2020

This doesn't seem to work on 18.10. At least not anymore.

image

Did you add the repository and update?
sudo add-apt-repository ppa:ondrej/php
sudo apt-get -y update

I just configured on a Ubuntu 18.04 on Azure.

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