#39484 [Com]: intermittent include failure under symlinked virtual hosts

[email protected] ("diebar dot uy at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               39484
 Comment by:       diebar dot uy at gmail dot com
 Reported By:      phpbugz at x0rz dot com
 Status:           No Feedback
 Bug Type:         Apache2 related
 Operating System: linux kernel 2.4.27 w/debian 3.1
 PHP Version:      5.2.0
 New Comment:

It's strange... I've differents vHosts, and this bug only appears on
two of them.


Previous Comments:
------------------------------------------------------------------------

[2008-08-09 22:00:39] 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-05-06 13:29:24] 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).

------------------------------------------------------------------------

[2007-07-09 01:00:01] 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".

------------------------------------------------------------------------

[2007-07-01 13:43:07] [email protected]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi



------------------------------------------------------------------------

[2006-11-12 23:21:49] phpbugz at x0rz dot com

Description:
------------
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:
---------------
<?
  set_include_path($_SERVER['DOCUMENT_ROOT']);
  include('foo_include.php');
  include('bar_include.php');
?>

Filesystem : 

/home/www -> /var/www

Apache : 

<VirtualHost>
  DocumentRoot /home/www
</VirtualHost>


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://moa.XXX.com/members_index.php"
["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) "moa.XXX.com" ["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) "moa.XXX.com" ["SERVER_ADDR"]=> string(12)
"1.2.3.4" ["SERVER_PORT"]=> string(2) "80" ["REMOTE_ADDR"]=> string(12)
"4.5.6.7" ["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* 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39484&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.