Bug #75528 [Opn->Csd]: Ignoring vhost document root when using php-cgi.exe in Apache2.4
| From: | ab@php.net | Date: | Sat, 05 May 2018 13:05:19 +0000 |
| Subject: | Bug #75528 [Opn->Csd]: Ignoring vhost document root when using php-cgi.exe in Apache2.4 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215055@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75528&edit=1
ID: 75528
Updated by: ab@php.net
Reported by: eziitiss at gmail dot com
Summary: Ignoring vhost document root when using php-cgi.exe
in Apache2.4
-Status: Open
+Status: Closed
Type: Bug
Package: CGI/CLI related
Operating System: Windows 10 1703 x64
PHP Version: 7.1.11
-Assigned To:
+Assigned To: ab
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2017-11-16 17:54:26] 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.
------------------------------------------------------------------------
[2017-11-15 20:07:51] 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>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75528&edit=1