php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: eziitiss at gmail dot com
New email:
PHP Version: OS:

 

 [2017-11-15 20:07 UTC] eziitiss at gmail dot com
Description:
------------
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
</IfModule>

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

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2018-05-05 13:05 UTC] ab@php.net
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.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 19:01:31 2024 UTC