As a developer, keeping my PHP version up to date is essential for performance and security. In this guide, I’ll show you how to install PHP 8.4 on Ubuntu 24.04, configure it for Apache or Nginx, and install necessary extensions.
Whether I’m setting up a new server or upgrading from an older version, these steps will help me get PHP 8.4 running smoothly.
How to Install PHP 8.4 on Ubuntu 24.04
To install PHP 8.4 on Ubuntu 24.04, follow these steps:
Ensure all existing packages are up to date:
sudo apt update && sudo apt upgrade -y
Ubuntu's default repositories may not include the latest PHP version. Add the OndÅ™ej Surý PPA, a trusted source for PHP packages:
sudo add-apt-repository ppa:ondrej/php -y
After adding the repository, update the package list:
sudo apt update
Now, install PHP 8.4:
sudo apt install php8.4 -y
To verify the installation:
php -v
Depending on your project's requirements, you may need additional PHP extensions. For example:
sudo apt install php8.4-mysql php8.4-xml php8.4-mbstring -y
For Apache users:
Install the PHP module for Apache:
sudo apt install libapache2-mod-php8.4 -y
Enable the module and restart Apache:
sudo a2enmod php8.4
sudo systemctl restart apache2
For Nginx users:
Install PHP-FPM:
sudo apt install php8.4-fpm -y
Ensure PHP-FPM is running:
sudo systemctl status php8.4-fpm
Configure Nginx to use PHP by editing your server block configuration to include:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
}
After updating the configuration, restart Nginx:
sudo systemctl restart nginx
By following these steps, PHP 8.4 should be successfully installed and configured on your Ubuntu 24.04 system.
You might also like:
In this guide, I'll walk you through how to optimize a Laravel 11 application for serverless deployment on AWS Lambd...
Sep-25-2024
In this tutorial we will see how to generate pdf and send email in laravel 8. For generating PDF file we will use l...
Dec-20-2021
In this article, we'll explore a simple way to validate passwords and confirm passwords using jQuery. Password valid...
Sep-02-2020
In this article, we will see how to get the current user location in laravel 9. Many times we are required to...
Mar-23-2022