1

I am trying to run two php versions with apache. One (PHP7) is setup with mod and the other (PHP8) I am trying to set up with CGI. I am currently testing both work using the different vhosts for https and http. I have the following virtual hosts in my httpd-vhosts.conf file:

<VirtualHost 0.0.0.0:80>
   SetEnv PHPRC "C:/Program Files/PHP/php-8.1.12/"
   ScriptAlias /php8112/ "C:/Program Files/PHP/php-8.1.12/"
   Action application/x-httpd-8112 "/php8112/php.exe"
   AddType application/x-httpd-8112 .php
   <Directory "C:/Program Files/PHP/php-8.1.12/">
      <Files "php.exe">
        Require all granted
      </Files>
   </Directory>
   DocumentRoot "D:/Test/Site/public"
   ServerName test.local
   CustomLog "C:/Users/me/Logs/test_access.log" combined
   ErrorLog "C:/Users/me/Logs/test_error.log"
</VirtualHost>

<VirtualHost 0.0.0.0:443>
   DocumentRoot "D:/Test/Site/public"
   ServerName test.local
   SSLEngine on
   SSLCertificateFile "C:/Program Files/Apache24/conf/server.cert"
   SSLCertificateKeyFile "C:/Program Files/Apache24/conf/server.key"
</VirtualHost>

and a simple index.php in D:/Test/Site/public:

<?php

phpinfo();

?>

Accessing via HTTPS works and correctly gives me the PHP Info page. Accessing via HTTP gives me a 404 Not Found error, however. Why would this be?

I have tried reordering the directives and adding a directory directive for the DocumentRoot directive. Neither seemed to make a difference.

I am using Apache 2.4 on Windows 10

Mat
  • 11
  • 2

0 Answers0