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-common sudo 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!

neoan @neoan

40 readers
Keywords
php php8 ubuntu
On topic

Install PHP 7.4 on Ubuntu

Finally PHP 7.4 is out! You have read about the new features, you have followed externals, you have gathered ideas on how new capabilities will save time. Let's get it running.

Static content pages - still the fastest web-experience

Tutorial: How to utilize blua.blue to generate static content for your website.

Scaffolding REST APIs with JWT authentication

Ever had the need for your own backend while developing your web-app?

Git: globally change GitHub-remotes from git@ to https

Does your IDE or composer set remote repositories to ssh rather than https? Or are repositories you are using set up that way? You are not alone. Let's fix it once and for all!

VueJS & neoan3: a love story.

Setting up neoan3 to play nice with Vue isn't hard. Here is how the two frameworks are combined to support fast, dynamic and rapid development.

SEO strategies for blua.blue

How to get your content listed where you want it to.

MySQL: ERROR1364 fix

The painful realization of why people use containers.

blua.blue PHP SDK

Create your own blog.

How to Build an Express App in Node That Reads From a Headless CMS

A headless CMS lets you design your own front-end, sometimes your own back-end. Let's set up a small application to get us started. Beginner friendly. Approx. 20 min. to reproduce / follow along

MySQL in PHP - how to deal with databases

How I handle MYSQL database transactions in PHP

Cross publishing to dev.to

How to publish your content to dev.to from blua.blue - hopefully

How to install global npm packages without sudo on Ubuntu

Running npm on a server can be painful. Privileges are there for a reason, and so is sudo. Running npm with sudo is not the solution.

Transformer - falling in love with PHP's magic methods all over again

PHP's magic functions have been around for a long time. But there were always good reasons to avoid them. Transformer is a practical and reliable way to make use of the most common operations we program: CRUD operations.

What is composer?

Composer has become PHP's package & dependency manager. Why you should use it.