开发者

PHP require works only once after clearing APC Cache, then 500 error. Why?

开发者 https://www.devze.com 2023-03-05 15:08 出处:网络
I\'ve got an APC issue. Parent.php is including another file with a relative path. e.g. require_once \'child.php\';

I've got an APC issue. Parent.php is including another file with a relative path. e.g.

require_once 'child.php';

If I clear apc_cache, then load Parent.php, it works. But on the subsequent load, it fails. Dying on require_once 'child.php'.

Clearly the relative path, when saved to apc_cache, is not being translated properly on the next load...

apc.inclu开发者_StackOverflow社区de_once_override is turned off, so it isn't that.

What else could it be?

Editing to add the error: PHP Fatal error: require_once() [function.require]: Failed opening required 'path/to/file.php'


If you have apc.stat=0 in your config, your problem could be related to this bug: https://bugs.php.net/bug.php?id=61854

Setting apc.stat=1 in my PHP config fixed this problem for me.


This is a stretch, but I saw issues related to that when you're working hard-linked files, which may be cached through a different path.

Regardless, sounds like a bug. Are you on the latest PHP and APC versions? If so, post a bug report.


i once had a strange issue with relative paths on APC too. The problem was it died with an fatal error, I'd solved this issue by following the thread here:

In my project the following lines got it to work:

// Realpath needed to fix problem with APC
require_once realpath($fullPath);


Had the same issue, downloading the correct version for my php version solved this issue. You can find a bunch of versions here ( if running on windows ): http://dev.freshsite.pl/php-accelerators/apc.html

0

精彩评论

暂无评论...
验证码 换一张
取 消