Start by updating your package list:
sudo apt update && sudo apt upgrade -y
This ensures you have the latest package information and system updates.
Install the necessary packages for adding PPAs:
sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https -y
These packages allow you to securely add external repositories to your system.
Add the official PHP PPA maintained by Ondřej Surý:
sudo add-apt-repository ppa:ondrej/php -y
This repository is trusted by the PHP community and provides the latest PHP versions for Ubuntu systems.
Refresh your package list to include the new repository:
sudo apt update
Now you can install PHP 8.4 with this simple command:
sudo apt install php8.4 -y
The installation process typically takes 2–3 minutes, depending on your internet connection.
Check if PHP 8.4 Ubuntu 24.04 installation was successful:
php -v
You should see output similar to:
PHP 8.4.0 (cli) (built: Nov 21 2024 15:37:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.0, Copyright (c) Zend Technologies
For web development, you’ll need additional PHP extensions. Here’s how to install PHP 8.4 with the most commonly used extensions:
Install PHP 8.4 with essential extensions:
sudo apt install php8.4 php8.4-cli php8.4-common php8.4-curl php8.4-mbstring php8.4-mysql php8.4-xml php8.4-zip php8.4-gd php8.4-intl php8.4-bcmath -y
© 2023 All right reserved to sobiztrend.com
Leave a Reply