sudo a2dismod php8.3
sudo a2enmod php8.4

Step 4: Configuring Apache to Use PHP 8.4

sudo apt update
sudo apt upgrade -y

sudo rm /var/www/html/info.php

echo “<?php phpinfo(); ?>” | sudo tee /var/www/html/info.php

Recommendation: If you need advanced configurations and features, go with Apache. If you prioritize performance and efficiency, Nginx is the better choice. Alternatively, using Nginx as a reverse proxy in front of Apache combines the strengths of both servers.
sudo apt install nginx -y

Install Nginx in Ubuntu
Install Nginx in Ubuntu

Installing PHP 8.4 on Ubuntu

First, it’s important to update your installed software package list to ensure that you have the latest information about available packages.
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
}

Make sure to remove the info.php file after testing, as it can expose sensitive information about your PHP configuration:
sudo apt install apache2 -y

Install Apache in Ubuntu
Install Apache in Ubuntu

Installing Nginx on Ubuntu

PHP is the most popular scripting language used to create dynamic websites. With the release of PHP 8.4, developers can enjoy a host of new features and improvements that enhance performance and provide additional functionality for web applications.
sudo systemctl restart apache2

echo “<?php phpinfo(); ?>” | sudo tee /var/www/html/info.php

http://your_server_ip/info.php

Confirm PHP 8.4 in Ubuntu 24.04
Confirm PHP 8.4 in Ubuntu 24.04
Conclusion

When using Nginx as your web server, PHP is processed through PHP-FPM (FastCGI Process Manager), which is a special service that handles PHP requests and runs them efficiently.
To configure Nginx to use PHP-FPM, you need to edit the default Nginx configuration file.

Similar Posts