php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57732 APC changes working directory of PHP, or resets it to webserver's root dir.
Submitted: 2007-07-03 11:58 UTC Modified: 2007-07-12 15:42 UTC
From: ninzya at inbox dot lv Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: 5.2.1 OS: Windows Server 2003 SP2
Private report: No CVE-ID: None
 [2007-07-03 11:58 UTC] ninzya at inbox dot lv
Description:
------------
When using relative paths for script inclusion (require(), require_once(), include(), include_once()), apc fails to execute *reproduce code* on second request. On first request, everything is fine and is working as expected, but on second i get fatal error, where script is reporting lack of requireable file "test.php" in apache's root dir.

require_once(D:\WebServer\Apache2.2\test.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in <b>D:\WebServer\WWW\test.php</b> on line <b>7</b>

D:\WebServer\WWW\ - document root
D:\WebServer\Apache2.2\ - Apache 2.2 root dir

Why PHP would seek for test.php in apache root? weird.

php.ini:

[apc]
apc.enabled =1
apc.shm_segments =1
apc.shm_size =64
apc.optimization =1
apc.num_files_hint =10000
apc.ttl =0
apc.gc_ttl =3600
apc.cache_by_default =On
apc.slam_defense =0
apc.file_update_protection =2
apc.enable_cli =0
apc.stat=0

"test.php" in *reproduce code* may contain whatever you can imagine in the solar system.

NOTE: code works with absolute path to "test.php"

Reproduce code:
---------------
<?php

if( defined( 'TEST'))
  die();
  
define( 'TEST', 1);
require_once( "test.php");

?>

Expected result:
----------------
Death of script with no errors

Actual result:
--------------
Script death with errors about apache root directory

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-03 12:04 UTC] anejibcuh at one dot lv
?????? ???!
 [2007-07-03 12:13 UTC] ninzya at inbox dot lv
I have discovered that if i set "apc.stat =1" in php.ini, the problem goes away.
 [2007-07-12 15:42 UTC] gopalv82 at yahoo dot com
Expected gotcha ... stat = 0 mode never touches the file and doesn't change into the directory or any such thing.

And the performance degrades when you use relative paths in stat = 0;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC