Cheeky Globals

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
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Cheeky Globals

Post by Gen-ik »

I've checked my PHP conf file (php.ini-dist) over and over again to make sure that register_globals is Off..... and it is. But, when I check the phpinfo() stuff it still shows register_globals as being On!!

Are there any other things I need to turn off in the conf file to get register_globals turned off?

I've also closed down and restarted Apach a couple to times just to make sure things get 'refreshed' but it makes no difference.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

is this really the ini-file your webserver uses? phpinfo() tells you.
Are both global and local settings for register_global On?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Eh?!? Now I'm confused.

Even though I've been editing the php.ini-dist file (found in the php folder) to add extensions to PHP the actual ini file that PHP is using is actually found in my windows directory........ but the extensions have been working fine even though I've been editing the wrong .ini file!?

I've changed the ini file (the one that PHP actually uses) to turn globals off and it now seems to work fine.

Does PHP use 2 ini files or am I just going mad?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

it might, but usually it does not ;)
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

placement

Post by phpScott »

There are actually serveral a coulpe places where you can place your php.ini file. I believe it can be in the c:\windows directory or it can be in your root apache directory.
For me that is c:\apache\Apache2\php.ini

as the documentation says
The php.ini files is only searched in two places:
1) in your Apache installation directory (e.g. c:\apache\apache)
2)in your %SYSTEMROOT% directory.
with $SYSTEMROOT% usually being c:\windows

phpScott
evilMind
Forum Contributor
Posts: 145
Joined: Fri Sep 19, 2003 10:09 am
Location: Earth

Post by evilMind »

When you run phpinfo() check for the text
"Configuration File (php.ini) Path /etc/apache2/php.ini"
which shows that the configuration file is located at /etc/apache2/php.ini

If that is not there... Where it shows you the "configured-with" section look for --with-config-file-path .<-- that will show you the base directory of the configuration file location.

Now that you know where the php.ini file it's using is located; make sure that pesty little config option which is giving you trouble says register_globals=Off. restart your web server and the changes will take effect.

Hope that helped.
Post Reply