How to Install PHP 8.0 on Ubuntu 23.10

To install PHP 8.0 on Ubuntu 23.10, you can use the following steps:

Step 1 : Update Package List

Update the package list to ensure you have the latest information on available packages:

Step 2 : Add the Repository.

Ondrej's PPA doesn't support non-LTS versions of Ubuntu. Nevertheless, we can proceed with the installation by following the steps below

Step 3 : Open the file '/etc/apt/sources.list.d/ondrej-ubuntu-php-mantic.sources' using a text editor.

Replace 'mantic' with 'jammy'

Step 4 : Run the update command again to ensure the system is aware of the changes:

Step 5 : Create a preference file for Ondrej's PHP repository by creating the file '/etc/apt/preferences.d/ondrejphp' and adding the following content:

Step 6 : Install PHP 8.0 Core Components

Install essential PHP 8.0 components, such as the command-line interface and essential modules:

Step 7 : Install Additional PHP 8.0 Extensions:

- mysql: PHP interaction with MySQL databases.

- common: Shared files and resources.

- curl: Making HTTP requests and interacting with servers.

- xsl: XML document processing with XSL transformations.

- gd: Image processing and manipulation.

- xml: Working with XML documents.

- zip: Creating and extracting zip archives.

- soap: Communication with web services using SOAP.

- bcmath: Arbitrary precision arithmetic functions.

- mbstring: Handling multibyte character encodings.

- gettext: Internationalization and localization for message translation.

- imagick: Working with the Imagick image manipulation library.

Step 8 : Verify Installed PHP Version

Check the installed PHP version to ensure the correct installation:

Step 9 : Configure PHP (Optional)

If needed, configure PHP based on your project's requirements. The main configuration files are typically located at /etc/php/8.0/cli/php.ini and /etc/php/8.0/fpm/php.ini.

Congratulations, you have successfully installed PHP 8.0 on Ubuntu 23.10 with additional extensions.