PHP IIS 6 ISAPI : Function are global
Posted: Thu Mar 13, 2008 3:56 am
Hi,
my name is Jacob and I run a windows 2003 server running PHP5 in ISAPI mode.
I have had a lot of trouble with this but now im down to my last problem which I do not understand. I am not a php developer so I hope you can help me.
I have isolated my problem to this scenario:
my php functions are beeing remebered Globally:
index1.php
index2.php
Okay here we go. If I start out by running index2.php it will ofcourse fail as it can not find the function. Then I run index1.php which works perfect 
Then I reload index1.php and now we have the problem:
Fatal error: Cannot redeclare test() (previously declared in E:\Web\Solutions\bkbad.webcetera.dk\index3.php:3) in E:\Web\Solutions\bkbad.webcetera.dk\index3.php on line 3
If however I now run index2.php I will work every time because the test() function exists somewhere in memory?
Why is this?
I have code that resembles index1.php so I need to be able to declare the functions every time I reload the page.
Thanks
Regards
/Jacob
my name is Jacob and I run a windows 2003 server running PHP5 in ISAPI mode.
I have had a lot of trouble with this but now im down to my last problem which I do not understand. I am not a php developer so I hope you can help me.
I have isolated my problem to this scenario:
my php functions are beeing remebered Globally:
index1.php
Code: Select all
<?php
function test() { echo 'test'; }
test();
?>
Code: Select all
<?php
test();
?>
Then I reload index1.php and now we have the problem:
Fatal error: Cannot redeclare test() (previously declared in E:\Web\Solutions\bkbad.webcetera.dk\index3.php:3) in E:\Web\Solutions\bkbad.webcetera.dk\index3.php on line 3
If however I now run index2.php I will work every time because the test() function exists somewhere in memory?
Why is this?
I have code that resembles index1.php so I need to be able to declare the functions every time I reload the page.
Thanks
Regards
/Jacob