Logo

How to Install PHP 8.3 on Ubuntu 23.04

Dec 02, 2023

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:

sudo apt update

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):

sudo add-apt-repository ppa:ondrej/php

- Open the file

/etc/apt/sources.list.d/ondrej-ubuntu-php-lunar.list

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

- Save the changes.

Step 3 : Update Again

Update the package list once more:

sudo apt update

Step 4 : Adjust Package Preferences

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

Package: libgd3
Pin: release n=lunar
Pin-Priority: 900

Step 5 : Install PHP 8.3 Core

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

sudo apt install 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:

sudo apt install php8.3-{mysql,curl,xsl,gd,common,xml,zip,xsl,soap,bcmath,mbstring,gettext,imagick}

Step 7 : Check PHP Version

Verify the installed PHP version:

php -v

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

Recommended