|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57790 apc_compile_file won't compile file with apc.stat =0
Submitted: 2007-08-17 23:26 UTC Modified: 2007-08-18 08:35 UTC
From: ninzya at inbox dot lv Assigned: shire (profile)
Status: Closed Package: APC (PECL)
PHP Version: Irrelevant OS: Windows XP
Private report: No CVE-ID: None
 [2007-08-17 23:26 UTC] ninzya at inbox dot lv
apc_compile_file() function is not bypassing apc.stat setting. if apc.stat =0, the old compiled file remains in memory, and i can't override that file's cache using apc_compile_file(). I'm using the same path to the php file, with the same symbols in same case (completely identical).

Reproduce code:
 $time =microtime( true);

 include ("D:/z.php");
 echo $time;
 $fp =fopen( "D:/z.php", "w");
 fputs( $fp, "<? $time =5; ?>");
 fclose( $fp);
 apc_compile_file( "D:/z.php");
 include ("D:/z.php");
 echo $time;

Expected result:
Expected to see timestamp and then number 5

Actual result:
Got two timestamps


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-17 23:35 UTC]
I have a pending fix for this, I'll check it in soon....
 [2007-08-17 23:54 UTC] ninzya at inbox dot lv
Added: Sometimes apache even crashes with this error message in error log: "[apc-error] Error compiling D:/Web/cache/struct/4279.php in apc_compile_file."

I'm trying to compile 3,546,818 bytes big php file.
 [2007-08-18 00:02 UTC] ninzya at inbox dot lv
Added: Seems that apache crash was related to memory exhaustion. I have set memory_limit from 50M to 100M in php.ini and now everything is fine, apache doesn't crash anymore. Anyway, this situation should not be handled this way, apache has to stay running. It would be nice if memory exhaustion occurs, warning is reported and php script continues running with boolean false returned from apc_compile_file(). In my case, php is installed as apache module.
 [2007-08-18 04:25 UTC]
Committed a change that should override any existing files that may be in your cache when using apc_compile_file.  Please try out the CVS version, it should work for you now.  

In regards to the memory consumption error, while you should recieve a fatal error anytime you go over memory_limit (even while using apc_compile_file), this should not crash your entire apache server.  It sounds like you are encounting a fatal error on a per-request basis.  For security/safety reasons I think we'll want to honor the memory_limit setting. (you can adust this at run-time with ini_set() however).  

Thanks for the bug report!
 [2007-08-18 08:35 UTC] ninzya at inbox dot lv
Thank you very much. Everything is now working fine.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC