Prerequsities

You must have SSH access to the Debian 10 system with Sudo privileges.

Apache Installation

Apache packages are available under default Apt repositories on all Debian systems. You can update the Apt cache and install Apache web server packages using the following command:

PHP Installation

For the PHP installation we recommend to use Ondřej Surý‘s PPA, which provides latest PHP versions for Debian systems. Add this PPA to your Debian system using the following commands: After that, install the required PHP version. You can simply execute the following commands for the default PHP version installation with PHP-FPM packages. After installing the above packages php7.3-fpm service will automatically be started. You can make sure by typing below command on terminal.

Apache Configuration

Now enable few modules required for the configuration of multiple PHP versions with Apache. These modules are necessary to integrate PHP FPM and FastCGI with the Apache server. Let’s configure the Apache VirtualHost to run with FPM/FastCGI. For this tutorial, we use default VirtualHost. Edit VirtualHost host configuration file in a text editor. You can create new VirtualHost as per your requirements, so make sure to enable any new VirtualHost. Update the configuration as followings.

Save your changes to the configuration file and restart Apache to reload the changes.

Test Setup

Create a PHP script with phpinfo() function and place it to your server document root. Use below command to do it. Now access the info.php using server IP address (for default VirtualHost) for your configured domain in Apache VirtualHost.

Conclusion

You have successfully configured an Apache with PHP-FPM on your Debian 10 (Buster) Linux. You can now host a website from your server.

How to Install Apache with PHP FPM on Debian 10   TecAdmin - 77