Page 1 of 1

Global Variables

Posted: Thu Sep 04, 2003 9:45 pm
by centipede
I am having trouble turning off my Global Variables. I am using the latest version of PHP, and in the ini-dist file Global Variables are set to 'off', but I am still able to use them... I know this because I test on another computer, and there my pages break due to Global Variables.

How can I turn them off on this machine? I am running Windows 2k sp4 w/ IIS.


Thanks!

Posted: Thu Sep 04, 2003 9:56 pm
by volka
try

Code: Select all

<?php phpinfo(); ?>
it will tell you which php.ini is used (Configuration File (php.ini) Path) as well as the status of register_globals (in the PHP Core section)

Posted: Thu Sep 04, 2003 10:07 pm
by centipede
Thank you VERY much... it was an ini i didn't realize was even there!!

but now that i have updated the ini, the change doesnt seem to be taking effect. i restarted my apache server, and restarted my browser, is there anything else i need to do?

do i just need to restart my os?



thanks again!!!!

Posted: Thu Sep 04, 2003 10:10 pm
by jason
Well, what exactly isn't working they way you think it should be working? It is probably doing exactly what it's supposed to do, you just don't think it should be doing it. =)

Posted: Thu Sep 04, 2003 10:17 pm
by centipede
Well an example is:

on this machine i used $DOCUMENT_ROOT and it worked fine. when i tested it on my work machine all of my $DOCUMENT_ROOT code broke the site. as well as other code. i asked on irc and was told that it was a Global Variables issue.

i would like to turn them off here, so that i can develop knowing FOR SURE, i am not using any Globals (i am very new to php).


thanks for the help so far!

Posted: Fri Sep 05, 2003 6:53 am
by volka
strange. What does phpinfo() tell you now about register_globals?
Did you copy the new php.ini to the right location (or php.ini-recommended and renamed it to php.ini) ?
In the php.ini in use there is a line
register_globals = Off
and not another entry register_globals...?

Posted: Fri Sep 05, 2003 7:42 am
by jason
You are using a global thought. $DOCUMENT_ROOT is a global. With register_globals off, you need to use $_SERVER['DOCUMENT_ROOT'] instead. That should solve your problem.