Install PHP 8.2.0 RC1 on Ubuntu 22.04 LTS

PHP has been one of the most popular scripting languages for web development since its first release of PHP in 1998 and is still one of the most loved languages. It is open source and widely used in web projects, even big social media company like Facebook uses JIT which is modified PHP.

In this article, you will learn how to install the latest PHP 8.2.x beta (2) on Linux and Windows systems for testing purposes.

Note: – Do not use the beta version of PHP for the production, it can cause instability in the project. However, according to the official report, the next release will be the second release candidate (RC2) and is planned to release on 15th Sep 2022.

So, let’s get started with the installation processes.

Current Stable BuildPHP 8.1.x
Current Beta BuildPHP 8.2.0 RC1 (Release Candidate)
Next Release Candidate Release Date15th September 2022
Final Stable Build Release Date8th December 2022

The Process of Installing the latest PHP 8.2.0 RC1

You can install the newest PHP beta/RC build on your server or personal computer using the following simple method. However, I found various tutorials regarding installing PHP 8 beta builds during my research online. Some methods were difficult to follow because I was getting errors in the end. But finally found the very least cluttered method.

Must Read: - How to Upgrade PHP 8.1 from Older version PHP?

Step – 1. Add Ondřej Surý PHP Repo. To the system

Using the Linux terminal, you need to add the “Quality Assurance” or QA Builds repository on your Ubuntu system. So, use the following command to do that.

sudo add-apt-repository ppa:ondrej/php-qa
Add PHP 8.2.0 Repository

Step – 2. Update the system

After adding the repository, the system needs to be updated. So, use the following command to update the system.

sudo apt-get update

Step – 3. Install PHP 8.2.0 RC1

When adding the repository and updating the system is done, then you can easily install the latest PHP beta build using the following command.

sudo apt install php8.2
Install PHP 8.2.0 Beta

Install Must Use or Required Modules/Extensions

PHP has the option to install or uninstall modules as per your requirement. However, when we installed PHP automatically got installed the core modules. So, using the following commands you can install PHP extensions and you can also check the installed PHP extensions.

Must Read: - How to Fix Missing Imagick Module on WordPress?
sudo apt install php8.2-{imagick,bz2,curl,intl,mysql,readline,xml,fpm,mbstring,zip,bcmath}

In between curly braces, you can mention all supported or your required modules to install, and you can separate them by using a comma.

You can also check the installed modules on your system using the following command:

sudo php -m

Switch PHP 8.2 for Webserver

As a web server is required for web development, many developers prefer to use PHP as the scripting language. So, if you are using an older version of PHP then you can switch to the latest PHP using the following commands.

For Apache Webserver

Apache is one of the oldest web servers and is still widely used to develop small and medium web projects. So, to switch to the latest PHP for Apache, use the following commands.

Disable the Old PHP:

sudo a2dismod php8.0

Enable the Latest PHP 8.2:

sudo a2enmod php8.2

Check Syntax Error:

sudo apache2ctl -t

Restart the Apache webserver:

sudo systemctl restart apache2.service

For NGINX Webserver

As with Apache webserver, you can’t use disable or enable PHP using the commands. And you must configure the PHP-FPM manually. So, use the following step, and you can configure it.

Execute the following command to edit the Server Block, which is located in /etc/nginx/sites-available/ directory:

sudo nano /etc/nginx/sites-available/default
Editing Nginx default server block for configuring latest PHP
Editing Nginx Default Server Block

As marked in the image above, you must comment out (Remove the pound/hash [#] sign) and edit the PHP-FPM path, which by default would be php8.0-fpm you must replace it with the latest PHP version number, like php8.2-fpm.

Check Syntax Error:

sudo nginx -t

Restart Nginx Webserver:

sudo service nginx restart

Summary

If you are a PHP developer, then this latest beta build would be interesting for you, you can test it on your testing project.

However, if you want to use the latest stable build then you must wait for the release. And don’t use the alpha or beta builds on your actual production projects.


Pronay Sarkar

Hello!
I am Pronay Sarkar, I love to write about tech and stuff.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.