PHP with APC: Fatal errors: Cannot redeclare class

后端 未结 7 1941
甜味超标
甜味超标 2020-12-24 07:57

Since I installed APC for PHP with PECL I get sometimes these errors: Cannot redeclare class xxx

xxx changes from time to time. I could disable APC but

7条回答
  •  一生所求
    2020-12-24 08:31

    Well it is a known problem with apc that it mixes up include_once directivse that are called relatively from different locations.

    So if you do include_once myclass.php and then in a subdirectory do include_once ../myclass.php apc could mix this up and think its different files and loads it twice.

    However this is fixed in later versions.

    If you can drill down your code to the class that is loaded twice you could do some checking if the class is already loaded with class_defined or some callable stuff.

    You can also use the apc.filter directive to prevent certain files from beeing cached at all.

提交回复
热议问题