|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39484 intermittent include failure under symlinked virtual hosts
Submitted: 2006-11-12 23:21 UTC Modified: 2007-07-09 01:00 UTC
Avg. Score:4.8 ± 0.4
Reproduced:8 of 8 (100.0%)
Same Version:3 (37.5%)
Same OS:1 (12.5%)
From: phpbugz at x0rz dot com Assigned:
Status: No Feedback Package: Apache2 related
PHP Version: 5.2.0 OS: linux kernel 2.4.27 w/debian 3.1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-11-12 23:21 UTC] phpbugz at x0rz dot com
the *first* include will fail intermittently if apache2 virtual host is pointing to a symlinked DocumentRoot.

problem is not easily reproducable and would occur perhaps 1 in 100 times, usually disappearing on refresh.

this issue has gone away since reconfiguring the apache virtualhost's DocumentRoot to point to an absolute path instead of a symlinked one.  a resolution was also found by setting an absolute path for the very first include within a script.

Reproduce code:

Filesystem : 

/home/www -> /var/www

Apache : 

  DocumentRoot /home/www

Expected result:
Occasionally observe the following :

*Warning*: include(some_include.php) [function.include]: failed to open stream: No such file or directory in *foo_include.php* on line *blah*

*Fatal error*: Call to undefined function foo_function() in *bar_include* on line *blah*

** noting that the first include fails but the second is ok.
** the include_path shown with this error will also point to the symlink path (/home/www in the 'reproduce code' example), not the symlink target.

Actual result:
code was added to dump the SERVER variables on include failure, keeping in mind the filesystem path is actually /var/www :

*Warning*: include(required/connect.php) [function.include]: failed to open stream: No such file or directory in */var/www/moa/XXX/includes/required_includes.php* on line *7*

*Warning*: include() [function.include]: Failed opening 'required/connect.php' for inclusion (include_path='/home/www/moa/XXX/') in */var/www/moa/XXX/includes/required_includes.php* on line *7*

array(34) { ["nokeepalive"]=> string(1) "1" ["ssl-unclean-shutdown"]=> string(1) "1" ["downgrade-1_0"]=> string(1) "1" ["force-response-1_0"]=> string(1) "1" ["HTTP_ACCEPT"]=> string(87) "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*" ["HTTP_REFERER"]=> string(40) "" ["HTTP_ACCEPT_LANGUAGE"]=> string(5) "en-us" ["HTTP_UA_CPU"]=> string(3) "x86" ["HTTP_ACCEPT_ENCODING"]=> string(13) "gzip, deflate" ["HTTP_USER_AGENT"]=> string(89) "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" ["HTTP_HOST"]=> string(15) "" ["HTTP_CONNECTION"]=> string(10) "Keep-Alive" ["HTTP_COOKIE"]=> string(42) "PHPSESSID=45f4ceaef2ff8824143aad70569ba022" ["PATH"]=> string(28) "/usr/local/bin:/usr/bin:/bin" ["SERVER_SIGNATURE"]=> string(0) "" ["SERVER_SOFTWARE"]=> string(102) "Apache/2.0.54 (Debian GNU/Linux) PHP/5.2.0-0.dotdeb.1 with Suhosin-Patch mod_ssl/2.0.54 OpenSSL/0.9.7e" ["SERVER_NAME"]=> string(15) "" ["SERVER_ADDR"]=> string(12) "" ["SERVER_PORT"]=> string(2) "80" ["REMOTE_ADDR"]=> string(12) "" ["DOCUMENT_ROOT"]=> string(22) "/home/www/moa/XXX/" ["SERVER_ADMIN"]=> string(18) "[no address given]" ["SCRIPT_FILENAME"]=> string(30) "/home/www/moa/XXX/menu.php" ["REMOTE_PORT"]=> string(5) "33073" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(3) "GET" ["QUERY_STRING"]=> string(11) "module_id=5" ["REQUEST_URI"]=> string(21) "/menu.php?module_id=5" ["SCRIPT_NAME"]=> string(9) "/menu.php" ["PHP_SELF"]=> string(9) "/menu.php" ["REQUEST_TIME"]=> int(1163034668) ["argv"]=> array(1) { [0]=> string(11) "module_id=5" } ["argc"]=> int(1) }

*Fatal error*: Call to undefined function conn() in */var/www/moa/XXX/security/session.php* on line *109* on line *109* 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-05-06 13:29 UTC] sev at kks-group dot ru
The bug still occurs in 5.2.5. include_path intermittently becomes unchangable (via ini_set(), set_include_path() and .htaccess).
 [2008-08-09 22:00 UTC] diebar dot uy at gmail dot com
I found this bug in PHP 5.2.5 running on RedHat 5.2 linux kernel 2.6.18-92.1.6.el5.
 [2008-08-09 22:04 UTC] diebar dot uy at gmail dot com
It's strange... I've differents vHosts, and this bug only appears on two of them.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 23 19:01:26 2020 UTC