Sathallrin Posted April 17, 2007 Share Posted April 17, 2007 I'm getting a really odd behavior with php. It is caching my classes. I have a very simple file: <?php class testclass{ } ?> The first time I run the page it works correctly and creates the class. If I run it again it simply does this: Fatal error: Cannot redeclare class testclass in C:\Inetpub\default\index.php on line 2 It doesn't matter what class name I use. The first time it executes it saves the class for future requests. My setup is IIS 6 on Windows Server 2003 PHP 5.2.1 installed as an ISAPI extension. If I restart IIS it seems to clear this cache and executes correctly the first time. But then it stays cached. *note This also occurs with define such as: define('test', true); executes the first time, states it is already defined the second. Anyone have any idea what would be causing this to happen? I've never seen this situation before. Quote Link to comment https://forums.phpfreaks.com/topic/47445-php-caching-classes/ Share on other sites More sharing options...
utexas_pjm Posted April 17, 2007 Share Posted April 17, 2007 Hmmm... are you including the class? If so try include_once() or require_once() instead of include() or require() Quote Link to comment https://forums.phpfreaks.com/topic/47445-php-caching-classes/#findComment-231596 Share on other sites More sharing options...
MadTechie Posted April 17, 2007 Share Posted April 17, 2007 yep that happends if you use require instead of require_once Quote Link to comment https://forums.phpfreaks.com/topic/47445-php-caching-classes/#findComment-231647 Share on other sites More sharing options...
Sathallrin Posted April 18, 2007 Author Share Posted April 18, 2007 Not including at all. this is the entire file: test.php <?php class testclass{ } ?> accessing at http://www.example.com/test.php (this url is only an example) Quote Link to comment https://forums.phpfreaks.com/topic/47445-php-caching-classes/#findComment-232277 Share on other sites More sharing options...
utexas_pjm Posted April 18, 2007 Share Posted April 18, 2007 Seems like maybe this is an IIS issue (who'd have guessed): http://www.vbulletin.com/forum/showthread.php?t=13187. Best, Patrick Quote Link to comment https://forums.phpfreaks.com/topic/47445-php-caching-classes/#findComment-232301 Share on other sites More sharing options...
Sathallrin Posted April 18, 2007 Author Share Posted April 18, 2007 Yeah, I agree this seems to be some kind of server setting issue. I've just no idea what could be causing it, or what setting I would need to change. I've looked through the settings and nothing stands out at me so I'm baffled to why this is occurring. Quote Link to comment https://forums.phpfreaks.com/topic/47445-php-caching-classes/#findComment-232326 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.