To install PHP 7.2 on Ubuntu 24.04, follow the steps below.
Step 1 : First, update your package index using the following command:
Step 2 : Add the Repository (ppa:ondrej/php)
Step 3 : Update your package index again:
Step 4 : Install PHP 7.2 core packages:
Step 5 : Install commonly used PHP extensions:
php7.2-mysql
: Enables PHP to interact with MySQL databases.php7.2-curl
: Allows PHP scripts to make HTTP requests and interact with APIs.php7.2-json
: Provides functions to encode and decode JSON data, facilitating data exchange.php7.2-xsl
: Enables PHP to apply XSLT stylesheets to XML data for transformation.php7.2-gd
: Allows PHP to create and manipulate images, useful for image processing tasks.php7.2-xml
: Provides functions for parsing and manipulating XML documents.php7.2-zip
: Enables PHP scripts to work with ZIP archives, facilitating file compression and extraction.php7.2-soap
: Allows PHP to interact with SOAP-based web services for communication between systems.php7.2-bcmath
: Provides functions for precise mathematical calculations with large numbers.php7.2-mbstring
: Handles multibyte character encodings for proper string manipulation.php7.2-common
: Includes common files for PHP, providing core functionality such as basic PHP functions and configuration files.
Step 6 : Verify the PHP version installed:
Congratulations! You have successfully installed PHP 7.2 on Ubuntu 24.04.