How to Install PHP 8.4 on Ubuntu 24.10

To install PHP 8.4 on Ubuntu 24.10, follow the steps below to ensure a successful setup.

Step 1 : Run the following commands to update your system's package list:

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

- Use the command below to add the ppa:ondrej/php repository:

- Locate the repository source file /etc/apt/sources.list.d/ondrej-ubuntu-php-oracular.sources and open it for editing:

Find the word oracular and replace it with noble.

Save and close the file.

Step 3 : Run the following command to update the package list after editing the repository:

Step 4 : To ensure compatibility with Ubuntu 24.10, you need to create a preferences file to prioritize the oracular release for the libgd3 package:

Add the following code:

Save and close the file.

Step 5 : Install the PHP 8.4 core packages:

Step 6 : Install the following PHP extensions, which are commonly required for web development:

- php8.4-mysql: Connects PHP applications to MySQL databases.

- php8.4-curl: Enables PHP to send HTTP requests and interact with APIs.

- php8.4-xsl: Provides XML stylesheet transformation functionality.

- php8.4-gd: Handles image manipulation and creation.

- php8.4-common: Contains commonly shared PHP files and configurations.

- php8.4-xml: Parses and handles XML files.

- php8.4-zip: Manages ZIP file creation and extraction.

- php8.4-soap: Enables communication using SOAP (Simple Object Access Protocol).

- php8.4-bcmath: Performs arbitrary-precision arithmetic.

- php8.4-mbstring: Handles multibyte string operations for non-ASCII text.

- php8.4-gettext: Adds localization and internationalization support.

- php8.4-imagick: Provides image processing using ImageMagick.

Step 7 : Verify that PHP 8.4 is installed by running:

Congratulations! You have successfully installed PHP 8.4 on Ubuntu 24.10.