Undefined index: SCRIPT_FILENAME

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
maniac9
Forum Commoner
Posts: 55
Joined: Fri Aug 01, 2003 12:27 am
Location: Arkansas, USA
Contact:

Undefined index: SCRIPT_FILENAME

Post by maniac9 »

I just moved everything over from Apache to IIS, and now I'm getting this error message suddenly...

Notice: Undefined index: SCRIPT_FILENAME

The code causing this is...

if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) exit;

I've used this plenty of times in IIS, and I'm pretty sure I kept my old php.ini - any ideas of what could be going on?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Check the output of

Code: Select all

echo '<pre>';
print_r($_SERVER);
echo '</pre>';
check and see what's being set, maybe you need to use another element.

Mac
maniac9
Forum Commoner
Posts: 55
Joined: Fri Aug 01, 2003 12:27 am
Location: Arkansas, USA
Contact:

Post by maniac9 »

Odd...

SCRIPT_FILENAME has always been there, but it isn't now...

I'm checking back through my ini to see if there might be something stupid I missed. I made sure all of the document roots were set and correct and everything, but with no luck
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

you're on M$IIS now.

as a friend uses for his motto: "linux, because i actually want to GET there."

he's been using that since M$ came out with "where do you want to go today?"

remember M$ thinks it's above standards and only conforms to them when forced to. look at what it gives, there may be an equivalent.


personally i think the world should unassimilate and get off winblows and use the flavor of posix that they each like best.....every one's different, but they're all compatible
maniac9
Forum Commoner
Posts: 55
Joined: Fri Aug 01, 2003 12:27 am
Location: Arkansas, USA
Contact:

Post by maniac9 »

sorry, but this isn't an anti M$ thread, even though I hate them too

this WAS working on IIS fine, better than on apache, actually...
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Is it a different version of IIS? Unfortunately this is one thing that can make it difficult to port PHP apps - configuration settings on the web server affecting $_SERVER variables.

Mac
maniac9
Forum Commoner
Posts: 55
Joined: Fri Aug 01, 2003 12:27 am
Location: Arkansas, USA
Contact:

Post by maniac9 »

I don't know...

The server that ran these scripts was windows 2003, IIS version 6.0 - but, I still developed them on XP, which is version 5.1

I think the problem may just lie in some weird configuration problem - I'll try these on my server when I get it back up...thanks for the help...
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Hi
Same problem.
At the Co $_SERVER['SCRIPT_FILENAME'] works fine but at home (Win 2k3 Server IIS 6) its showing undefined index. Thats odd because before I had php4.3.4 and I think it worked there. Now I'm having php4.3.7.
maniac9 - What ver of php are you using now ?
Thanks
Post Reply