title: Apache2.4 - PHP 5.6 and PHP7.1 running at the same time
body: <p>I'm looking to run both PHP 5.6 and 7.1 in my development server (Debian 9), with Apache. I know that Nginx can easily handle this, but I really need Apache.</p>
  
  <p>Here so <code>confs</code></p>
  
  <pre><code># My main configuration file, running with PHP7.1
  
  &lt;VirtualHost xx.xx.xx.xx:80&gt;
      ServerName www.mydomain.com
      ServerAlias mydomain.com
  
      DocumentRoot /var/www/mydomain.com/html
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost xx.xx.xx.xx:80&gt;
      ServerName xx.xx.xx.xx
  
      &lt;Directory /&gt;
          Deny from all
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  
  
  # PHP 5.6
  
  &lt;VirtualHost xx.xx.xx.xx:80&gt;
      ServerName foo.mydomain.com
  
      DocumentRoot /var/www/foo.mydomain.com/html
  
      &lt;FilesMatch \.php$&gt;
          SetHandler "proxy:unix:/var/run/php/php5.6-fpm.sock"
      &lt;/FilesMatch&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>The 7.1 is working, while 5.6 returns a 404. Thanks !</p>