开发者

PHP and iis - cannot redifine class

Occasionally when running a PHP website i get the following error:

“Fatal error: Cannot redeclare class ExampleClass in 
              C:\website\ExampleClass.php on line 5”

however line 5 in the file is :

 require_once C:\websi开发者_JS百科te\ExampleClass.php

Now the interesting thing is that this error only occurs every once and awhile, and restarting the web server gets rid of it, so i'm more inclined to believe that its a problem with the web server configuration, and not the code.

Is there a security setting in iis that prevents the execution of scripts for any reason (too many errors / execution attempts?)

Thanks,

* edit *

This happened again today, and when it occurs it seems to affect all pages in the website, and same error is generated across all pages. (Cannot Redefine Class at line 5). Line 5 is the line the class is defined on in a separate file, however it seems to only be accessed using _once calls.

The error went away after i cleared the application pool in IIS 5. Any idea's as to why clearing the application pool would effect anything, or why this error occurs at random intervals?


IIS couldn't make PHP forget that it's included a file already. This include "memory" is per-script execution, and doesn't survive past the end of the script. Most likely you are including the file again somewhere else, using a regular require directive.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜