How to Install PHP 8.3 on Ubuntu 23.04

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

Step 1 : Update

Ensure that your system is up to date by running:

Step 2 : Add the Repository

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"

- Save the changes.

Step 3 : Update Again

Update the package list once more:

Step 4 : Adjust Package Preferences

Create the file /etc/apt/preferences.d/ondrejphp and add the following content:

Step 5 : Install PHP 8.3 Core

Install PHP 8.3 core components (php8.3 php8.3-cli php8.3-fpm):

Step 6 : Install Common Extensions

Install commonly used PHP extensions:

- mysql: MySQL database support.

- curl: Client URL library for URL handling.

- xsl: XSLT (Extensible Stylesheet Language Transformations) processor.

- gd: Graphics Draw library for image processing.

- common: Shared files for PHP.

- xml: XML support.

- zip: Zip archive support.

- soap: SOAP (Simple Object Access Protocol) support.

- bcmath: Arbitrary precision mathematics.

- mbstring: Multibyte string support.

- gettext: Internationalization functions.

- imagick: ImageMagick PHP extension for image processing.

Install these extensions using:

Step 7 : Check PHP Version

Verify the installed PHP version:

Congratulations! You have successfully installed PHP 8.3 on Ubuntu 23.04 with necessary extensions.