Question

any tutorial on how to install fastCGI in apache ubuntu24?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey Rashwan! 👋

The article you found is still mostly valid for Ubuntu 24, though there are a few differences in package names and potentially new configuration steps in the newer version.

Here’s an updated guide on how to install and configure FastCGI with Apache on Ubuntu 24.

1. Install Apache and PHP-FPM

First, install Apache and PHP-FPM on Ubuntu 24:

sudo apt update
sudo apt install apache2 libapache2-mod-fcgid php-fpm

During the installation note the PHP version:

php -v

2. Enable the Necessary Apache Modules

Once installed, you need to enable some required Apache modules:

sudo a2enmod actions fcgid alias proxy_fcgi

This makes sure that Apache can work with PHP-FPM via FastCGI.

If you want to use MPM Event as per the article that you’ve shared:

  • Disable the Pre-fork MPM module:
sudo a2dismod mpm_prefork
  • Enable the Event MPM module:
sudo a2enmod mpm_event

3. Configure Apache to Use PHP-FPM

Now you’ll configure Apache to pass PHP requests to PHP-FPM. Enable the PHP FPM config:

sudo a2enconf php8.3-fpm

4. Restart Apache

After all that, restart Apache to apply the changes:

sudo systemctl restart apache2

5. Verify PHP-FPM is Running

Make sure PHP-FPM is running and configured correctly by checking the status:

sudo systemctl status php8.3-fpm.service

Change the php8.3-fpm with the PHP version that was installed.

6. Test Your Setup

To test your setup, create a simple info.php file in your web root:

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

Now visit http://your-server-ip/info.php in your browser. You should see the PHP information page, which confirms that PHP-FPM is working through FastCGI.

The basic setup for FastCGI on Apache with Ubuntu 24 is pretty similar to Ubuntu 18.04. Just make sure to use the updated packages and modules in the newer version of Ubuntu.

Let me know if you run into any issues! 🚀

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more