Computing

Installing PHP 8.2 on Ubuntu 22.04 x64

8.2 is the latest major version of PHP, which was released on the 8th of December 2022. You can read up on new features and changes here.

To install PHP 8.2 on Ubuntu 22.04

Start by updating the package list:

sudo apt update

Add the independent software sources:

sudo apt install software-properties-common

Now add the repository which contains the up-to-date PHP release versions:

sudo add-apt-repository ppa:ondrej/php

Press enter when prompted.

For apache2:

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

Or for Nginx:

sudo apt install php8.2 php8.2-fpm

Press y to confirm and install.

Next you can install some PHP extensions:

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

Restart apache:

sudo systemctl restart apache2

Or restart Nginx:

sudo systemctl restart nginx

If you already had a lower PHP version installed you can switch to 8.2 with:

Apache2:

sudo a2dismod php8.1

sudo a2enmod php8.2

Nginx:

sudo a2disconf php8.1-fpm

sudo a2enconf php8.2-fpm

You will need to restart the web server again (apche2 or Nginx).

Confirm your PHP version with:

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