|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75528 Ignoring vhost document root when using php-cgi.exe in Apache2.4
Submitted: 2017-11-15 20:07 UTC Modified: 2018-05-05 13:05 UTC
From: eziitiss at gmail dot com Assigned: ab (profile)
Status: Closed Package: CGI/CLI related
PHP Version: 7.1.11 OS: Windows 10 1703 x64
Private report: No CVE-ID: None
 [2017-11-15 20:07 UTC] eziitiss at gmail dot com
Using apache2.4.29 x64 from ApacheLounge with mod_fcgid and php 7.1.11 nts.
Have configured 2 virtual hosts each using a different path:
vhost 1 path: c:/Apache24/htdocs
vhost 2 path: c:/website

under htdocs: exists one file index.php
under website: exists 2 files index.php and index.html

When calling vhost1/index.php - page opens as expected
When calling vhost2/index.html - page opens as expected
When calling vhost2/index.php - instead of opening index.php from website folder, it opens index.php from htdocs folder.

The php script inside the index.php files is only an echo with page name where I have been landed.

When I remove from apache config file php-fcgi integration all works as expected (correct php code is displayed as uninterpreted text)

fcgi configurationL
<IfModule fcgid_module>
	# Where is your php.ini file?
	FcgidInitialEnv PHPRC        "c:/php7111nts" 

	AddHandler fcgid-script .php  
	FcgidWrapper "c:/php7111nts/php-cgi.exe" .php

Vhost configuration:
<VirtualHost *:80>
    DocumentRoot "c:/Apache24/htdocs"
    ServerName localhost
	<Directory "c:/Apache24/htdocs">   
		Options Indexes FollowSymLinks MultiViews ExecCGI
		AllowOverride None
		Require all granted

<VirtualHost *:80>
    DocumentRoot "c:/website"
	<Directory "c:/website">   
		Options Indexes FollowSymLinks MultiViews ExecCGI
		AllowOverride None
		Require all granted


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-16 17:54 UTC] eziitiss at gmail dot com
I was able to workaround it myself by disabling the doc_root parameter in php.ini file and enabling cgi.force_redirect. Still, this behavior was not the expected one. I  would expect that pages outside the doc_root directory would not work at all, not displaying the page that's inside the doc_root directory.
 [2018-05-05 13:05 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2018-05-05 13:05 UTC]
Thanks for the report. Apache won't be able to tell the difference with the configuration you use. Either it has to be a diferent host name, or different port. Please check Apache documentation for the further info.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Aug 05 00:01:23 2021 UTC