How to Install PHP 8.3 on Ubuntu 24.04

May 02, 2024

To Install PHP 8.3 on Ubuntu 24.04, follow these steps:

Step 1 : Update your package index to ensure you have the latest version information:

sudo apt update

Step 2 : Add the repository containing PHP 8.3. This repository provides updated versions of PHP:

sudo add-apt-repository ppa:ondrej/php

Step 3 : Update your package index again to include the new repository:

sudo apt update

Step 4 : Install PHP 8.3 core components including the command-line interface and FastCGI Process Manager:

sudo apt install php8.3 php8.3-cli php8.3-fpm

Step 5 : Install commonly used PHP extensions:

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

Explanation of extensions:

- php8.3-mysql: MySQL database support

- php8.3-curl: cURL library for URL handling

- php8.3-xsl: XSL module for XML manipulation

- php8.3-gd: GD library for image processing

- php8.3-common: Common functions for PHP

- php8.3-xml: XML support

- php8.3-zip: ZIP archive support

- php8.3-soap: SOAP support

- php8.3-bcmath: Arbitrary precision mathematics support

- php8.3-mbstring: Multibyte string support

- php8.3-gettext: Gettext support for multi-language systems

- php8.3-imagick: Imagick PHP extension for image manipulation using ImageMagick

Step 6 : Verify the PHP version to confirm the installation:

php -v

Congratulations! You have successfully installed PHP 8.3 on your Ubuntu 24.04 system.