To install PHP 7.4 on Ubuntu 24.10, follow the steps below.
Step 1 : Update your system
Step 2 : Since ppa:ondrej/php
does not officially support non-LTS versions of Ubuntu, follow these steps:
- Add the repository:
- Open the file /etc/apt/sources.list.d/ondrej-ubuntu-php-oracular.sources
and replace "oracular" with "noble".
- Change oracular
to noble
and save the file.
Step 3 : Update again
Step 4 : Create the file /etc/apt/preferences.d/ondrejphp
and add the following code:
Step 5 : Install PHP 7.4 core
Step 6 : Install commonly used extensions (mysql, curl, json, xsl, gd, xml, zip, soap, bcmath, mbstring, gettext, imagick).
Explanation of common extensions:
- mysql: Allows PHP to interact with MySQL databases.
- curl: For making HTTP requests.
- json: To handle JSON data.
- xsl: For working with XSLT transformations.
- gd: For image processing.
- xml: To handle XML data.
- zip: For creating and extracting zip archives.
- soap: For integrating with SOAP-based web services.
- bcmath: For arbitrary precision mathematics.
- mbstring: For multi-byte string handling.
- gettext: For localization support.
- imagick: For advanced image manipulation.
Step 7 : Check the installed PHP version
Congratulations, you have successfully installed PHP 7.4 on Ubuntu 24.10!