Categories: Development

Installing Apache and PHP 8.1 on Ubuntu 21.10

Installing Apache and PHP 8.1 on Ubuntu 21.10 x64. This post covers creating an HTTP web server using Apache with the new PHP 8.1 version.

You will need sudo permissions for this.

Start by updating the package list with

sudo apt update

Installing Apache HTTP webserver

Once that has finished running, install apache2

sudo apt install apache2

Apache is the number one, open-sourced HTTP server and comes ready to use.

If you have UFW (firewall) running you will need to allow Apache through

sudo ufw allow 'Apache'

You can check Apache’s status with

sudo systemctl status apache2

This will tell you if Apache is running or not.

Installing PHP 8.1

PHP version 8.1 was released November 25th 2021, as of this blog post the latest version is 8.1.1

You may need to install the independent software sources, this can be done with

sudo apt install software-properties-common

This is needed for the latest PHP versions repository

sudo add-apt-repository ppa:ondrej/php

Now to install PHP 8.1 and the PHP 8.1 module for Apache

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

Installing PHP 8.1 extensions is done in the following format:

sudo apt install php8.1-[extension_name]

An example with a few common extensions

sudo apt install php8.1-{curl,mysql,xml}

Restart Apache

sudo systemctl restart apache2

Check and confirm the PHP version

php -v

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago