In this tutorial, you’ll learn how to install PHP and Composer on Ubuntu 24.04 LTS (you can use the same commands on Ubuntu 26.04 LTS too, the only things that differ is the php version, in 24.04 is PHP 8.3 and in 26.04 is PHP 8.5).
We install PHP CLI, common PHP extensions, curl, unzip, and php-zip, then download Composer from the official installer, verify the SHA-384 hash, install Composer globally, and run composer diagnose to check for common issues.
Covered in this video:
Install PHP on Ubuntu 24.04
Install required PHP extensions
Download Composer safely
Verify Composer installer hash
Install Composer globally
Fix missing Composer pubkeys
Fix zip extension not loaded warning
Test Composer with a package install