Install PHP 8 on Ubuntu

PHP8 has finally been released and it is FAAAAST! Time to update.

Installation

If you are running php7.x, it's likely you are already using the following repository. If not, here are the commands:

sudo apt install software-properties-commonsudo add-apt-repository ppa:ondrej/php

Now let's install PHP8:

sudo apt update

APACHE

sudo apt install php8.0 libapache2-mod-php8.0

When you are done installing your extensions, don't forget to restart with sudo service apache2 restart(or sudo systemctl restart apache2 )

NGINX

sudo apt install php8.0-fpm

When you are done installing your extensions, don't forget to restart with sudo service nginx restart(or sudo systemctl restart nginx )

Extensions

Before we give it a spin, let's install some common extensions we might need.(The following list is based on neoan3 requirements, feel free to check what you need for the setup of your choice)

sudo apt install php8-0-{mysql,zip,xml,curl} or install them one-by-one in this format:

sudo apt install php8.0-xml (see a list here)

Happy hacking!

Author

author image

neoan

Metrics

Readers: {{metrics.unique}}

Total visits: {{metrics.total}}

Keywords

php,php8,ubuntu

Suggestions