

Create a file for the first virtual host and edit in your favorite text editor.Īdd the following content. Apache keeps all the VirtualHost configuration files under /etc/apache2/sites-available with the extension. This will help users to view and confirm, what PHP version is used by the VirtualHost. Now, create and index.php containing the phpinfo() function. Now create two seprate directories on your system for both sites configuring on your system. These modules are necessary to integrate PHP FPM and FastCGI with Apache server. Now enable few modules required for the configuration of multiple PHP versions with Apache. Execute the following commands to install the latest available version of Apache web server. Launch terminal on your system or login with ssh for remote systems. Install Apache web server from the official repository. Use the following commands to make sure both services are running. Run the following commands to install PHP and FPM on the Debian system.Īfter installation, php-fpm services will be started automatically. To use the multiple PHP versions, we will use PHP FPM and FastCGI. This tutorial uses PHP 5.6 and PHP 7.2 to configure with Apache web server. Use the below couple of commands to add the PPA on your Debian system.

PHP Installation #įor the installation of PHP versions, we use the PPA maintained here. You can also use more than two PHP versions with Apache as required but this tutorial covers two only.

First VirtualHost will work with PHP 5.6 and another VirtualHost will run with PHP 7.2. This tutorial describes the installation and configuration of two VirtualHost on Apache with separate PHP versions.
