To install PHP 8.0 on Ubuntu 24.04, follow these steps:
Step 1 : Update
Ensure your system is up to date by running:
Step 2 : Add the Ondřej Surý PHP PPA repository:
Step 3 : Update your package list to include the newly added repository:
Step 4 : Install PHP 8.0 core packages including CLI and FPM:
Step 5 : Install commonly used PHP extensions such as MySQL, cURL, XSL, GD, XML, Zip, SOAP, BCMath, Mbstring, and Imagick:
Explanation of Extensions:
- php8.0-mysql
: MySQL database support
- php8.0-curl
: Client URL library for URL handling
- php8.0-xsl
: XSL module for PHP
- php8.0-gd
: GD library for image processing
- php8.0-common
: Common files for PHP
- php8.0-xml
: XML module for PHP
- php8.0-zip
: ZIP archive support
- php8.0-soap
: SOAP module for PHP
- php8.0-bcmath
: BCMath arbitrary precision mathematics module for PHP
- php8.0-mbstring
: Multibyte string module for PHP
Step 6 : Verify that PHP 8.0 is installed by checking the version:
Congratulations! You have successfully installed PHP 8.0 on Ubuntu 24.04.