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…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago