How to Install PHP 8.2 on Ubuntu 23.04

To install PHP 8.2 on Ubuntu 23.04, follow the steps below.

Step 1 : Update

Step 2 : Since ppa:ondrej/php does not officially support non-LTS versions of Ubuntu, follow these steps:

- Add the Repository (ppa:ondrej/php)

- Open the file:

- Find "lunar" and replace it with "jammy".

- Make the necessary change and save the file.

Step 3 : Create the file /etc/apt/preferences.d/ondrejphp and add the following code:

Add the following content:

Save the file.

Step 4 : Update again.

Step 5 : Install PHP 8.0 core (php8.0 php8.0-cli php8.0-fpm)

Step 6 : Install commonly used extensions:

Explanation:

- mysql: MySQL database support.

- curl: Client URL library for making requests.

- xsl: XSLT processing.

- gd: Image manipulation library.

- common: Common files for PHP.

- xml: XML parsing support.

- zip: ZIP archive support.

- soap: SOAP support.

- bcmath: Arbitrary precision mathematics.

- mbstring: Multibyte string support.

- gettext: Gettext support for internationalization.

- imagick: ImageMagick PHP extension for image processing.

Step 7 : Check PHP Version

Congratulations, you have successfully installed PHP 8.2 on Ubuntu 23.04 with commonly used extensions.