PHP IIS 6 ISAPI : Function are global

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
webcetera
Forum Newbie
Posts: 1
Joined: Thu Mar 13, 2008 3:44 am

PHP IIS 6 ISAPI : Function are global

Post by webcetera »

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

Code: Select all

 
<?php
function test() { echo 'test'; }
 
test();
?>
 
index2.php

Code: Select all

 
<?php
test();
?>
 
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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: PHP IIS 6 ISAPI : Function are global

Post by Weirdan »

can we see index3.php mentioned in the error message too?
Post Reply