CMiksche / dbd-modules

Automatically exported from code.google.com/p/dbd-modules
0 stars 0 forks source link

php global variable $_SERVER['DOCUMENT_ROOT'] is set to default value #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. Compile latest version according to the manual.
2. Create a few virtual hosts via database table and related folders on the 
host (Example: test1.com - /srv/www/test1, test2.com - /srv/www/test2).
3. Create index.php files under each folder. Files contain the following code:

<?=$_SERVER['DOCUMENT_ROOT']; ?>

4. Open each domain in a web browser.

Each domain should show different path. Instead module resolves domain names 
into directory paths correctly, but DOCUMENT_ROOT is set to default value 
(/srv/www).

I am using dbd-modules.1.0.5? I got the same results under Fedora 13 (64bit) 
Apache/2.2.16 and Fedora 9 (32bit), Apache/2.2.8?

Please provide any additional information below.

Original issue reported on code.google.com by dzysyak on 24 Aug 2010 at 9:51

Attachments:

GoogleCodeExporter commented 9 years ago
mod_vhost_dbd does not change the httpd server variable named document_root.  

The reason is that a single copy of this httpd server variable is used 
simultaneously by multiple requests.  PHP defines it as 'The document root 
directory under which the current script is executing, as defined in the 
server's configuration file.'  

Updated the WiKi to state this explicitly, as it isn't apparent that the 
'document root as defined in the server's configuration file' is not the same 
as the 'document root directory for a request' which is set by mod_vhost_dbd.

Original comment by Thomas.D...@gmail.com on 17 Dec 2010 at 9:39

GoogleCodeExporter commented 9 years ago

Original comment by Thomas.D...@gmail.com on 17 Dec 2010 at 9:44

GoogleCodeExporter commented 9 years ago

Original comment by Thomas.D...@gmail.com on 18 Dec 2010 at 12:10

GoogleCodeExporter commented 9 years ago

Original comment by Thomas.D...@gmail.com on 16 Mar 2011 at 9:51

GoogleCodeExporter commented 9 years ago
this option should be implemented!

Original comment by pawel....@gmail.com on 7 Feb 2012 at 8:04

GoogleCodeExporter commented 9 years ago
Why should this be implemented?

Apache currently stores a single DocumentRoot per server (i.e. per Virtual 
Host), and all simultaneous requests use it at the same time.   PHP, J2EE, etc. 
read a copy of Apache's single DocumentRoot.

To make $_SERVER['DOCUMENT_ROOT'] (for PHP), 
GetServletContext().GetRealPath("/") (for J2EE), etc. show the directory 
selected by mod_vhost_dbd, it would require the module to store a separate 
variable for each request - and require changes to each of these languages 
(PHP, J2EE, etc) to access the new per-request variable instead of Apache's 
per-server DocumentRoot variable.

While this might be possible (anything is possible) - it would be a large and 
unwieldy change to mod_vhost_dbd, and it would also require cooperative changes 
from all the various web languages (like PHP, Perl, ColdFusion, Java/J2EE, 
etc.) to use it.

This does not seem like a reasonable change, since the directory selected by 
mod_vhost_dbd is already available in all these languages - just not in the 
variable named DocumentRoot.

Original comment by Thomas.D...@gmail.com on 7 Feb 2012 at 3:44