sajad torkamani

Add PPA repository

Ubuntu’s default PPA repositories will probably not include the latest PHP version so you’ll want to add ppa:ondrej/php.

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

Install PHP packages

Head over to the PHP website to check the current stable version. At the time of writing, this is 8.4.8.

Assuming we’ll use PHP with MySQL, we’ll want to install the following packages.

php_version=8.4 && sudo apt install php$php_version-fpm php$php_version-mysql php$php_version-xml php$php_version-curl php$php_version-zip

You may need to install more packages with time.

Verify installation

php -v

This should output something like:

PHP 8.4.7 (cli) (built: May  9 2025 06:54:31) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.7, Copyright (c), by Zend Technologies
Tagged: PHP

Leave a comment

Your email address will not be published. Required fields are marked *