Bug #2461: Can't use PHP CGI for PHP-scripts outside of the _webserver_ document root

From: Date: Thu, 07 Oct 1999 10:19:35 +0000
Subject: Bug #2461: Can't use PHP CGI for PHP-scripts outside of the _webserver_ document root
Groups: php.dev 
Request: Send a blank email to php-dev+get-11603@lists.php.net to get a copy of this message
From: ewas@dds.nl Operating system: Mandrake-linux 6.1 PHP version: 3.0.12 PHP Bug Type: Installation problem Bug description: Can't use PHP CGI for PHP-scripts outside of the _webserver_ document root I (try to) use the PHP CGI-version under Apache 1.3.9 with redirection by means of an Action directive as outlined in the PHP manual. My php scripts are in a subdirectory under my homedirectory /home/user/webdocs. The PHP CGI binary is under /home/user/cgi-bin/php. Apache is configured (using Alias and ScriptAlias) so that /home/user/webdocs/ is mapped to http://my.host/user/ and /home/user/cgi-bin/ to http://my.host/cgi-bin-user/ The PHP doc_root is set to /home/user/webdocs in php.ini When I call one of my php-scripts like http://my.host/user/test.php3 PHP complains it can't find the file: /home/user/webdocs/user/test.php3, which of coarse doen't exist, it should look for /home/user/webdocs/test.php3 It seems that PHP doesn't use the PATH_TRANSLATED environment variable set by apache (which is the location of the page being called on the filesystem) for opening the PHP page. Instead it seems to look for doc_root/$REDIRECT_URL . This works fine as long as the PHP pages are under the web server's document root; then doc_root/$REDIRECT_URL is equal to PATH_TRANSLATED (which is the location of the php page called on the filesystem). In my case however my php documents are outside of the web server's document root, so doc_root/$REDIRECT_URL is not the location of the php pages on the filesystem.

« previous php.dev (#11603) next »