To install PHP 7.4 on Ubuntu 23.10, you can use the following steps:
Step 1 : Update Package List:
Make sure your package list is up-to-date.
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'
Replace 'mantic' with 'jammy'
Step 4 : Update Package List After Adding the PPA:
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 7.4 Core
Install PHP 7.4 core components:
Step 7 : Install Additional PHP 7.4 Extensions
Explanation of Extensions:
- mysql: Enables PHP to interact with MySQL databases.
- common: Includes shared files and resources commonly used by PHP.
- curl: Allows PHP to make HTTP requests and interact with external servers.
- json: Provides functions for working with JSON data.
- xsl: Supports XML document processing with XSL transformations.
- gd: Enables image processing and manipulation.
- xml: Provides functionality for working with XML documents.
- zip: Allows PHP to create and extract zip archives.
- soap: Supports communication with web services using SOAP.
- bcmath: Provides arbitrary precision arithmetic functions.
- mbstring: Supports handling multibyte character encodings.
- gettext: Enables internationalization and localization for message translation.
- imagick: Allows PHP to work with the Imagick image manipulation library for advanced image processing.
Step 8 : Configure PHP (Optional)
Depending on your use case, you might need to configure PHP. The main configuration file is usually located at /etc/php/7.4/cli/php.ini
for the command-line interface and /etc/php/7.4/fpm/php.ini
for PHP-FPM.
Step 9 : Check Installed PHP Version
This command should display information about PHP 7.4.
Now, PHP 7.4 should be installed on your Ubuntu 23.10 system.