PHP folks... need help!

NikPreviousAcct

No Lifer
Aug 15, 2000
52,763
1
0
When browsing to a newly added folder on the webserver, I get nothing but this:

FATAL ERROR: register_globals is disabled in php.ini, please enable it!

I found php.ini and set "register_globals = On", saved the file, and quit vi, but I keep getting the same error message.

:confused: Suggestions?
 

Kilrsat

Golden Member
Jul 16, 2001
1,072
0
0
Its telling you that the register_globals option in your php.ini file is set to 0 or false.

I'd guess that in your previous folders there was either an .htaccess file or right in the main apache config something like this:

"php_value register_globals 1"

So the quick fix is to stick a .htaccess file in that new folder with that line in it. The longer fix involves deciding if enabling register_globals is a good idea (common practice is that register_globals is *not* a good thing), and if not, fixing your php code so it doesn't depend on it. If you decide it is a good idea, then enabling it in the php.ini file means you don't have to fiddle with enabling it in multiple places.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
It's always safer to write code that doesn't depend on register_globals being enabled especially if you are writing code that can be used by other people.
 

NikPreviousAcct

No Lifer
Aug 15, 2000
52,763
1
0
Originally posted by: Kilrsat
Its telling you that the register_globals option in your php.ini file is set to 0 or false.

I'd guess that in your previous folders there was either an .htaccess file or right in the main apache config something like this:

"php_value register_globals 1"

So the quick fix is to stick a .htaccess file in that new folder with that line in it. The longer fix involves deciding if enabling register_globals is a good idea (common practice is that register_globals is *not* a good thing), and if not, fixing your php code so it doesn't depend on it. If you decide it is a good idea, then enabling it in the php.ini file means you don't have to fiddle with enabling it in multiple places.

So if I just dump a .htaccess file into all the subdirectories of the directory that I'm working with, all I have to include is just the line "php_value register_globals 1" right?
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: MCrusty
It's always safer to write code that doesn't depend on register_globals being enabled especially if you are writing code that can be used by other people.

Yep. I wouldn't touch anything that requires it; it shows they're either behind the times or just suck.

(and by "behind the times" I mean "register globals was already considered a generally bad thing when I was doing php ~2 years ago")
 

Beau

Lifer
Jun 25, 2001
17,730
0
76
www.beauscott.com
Originally posted by: Nik
Originally posted by: Kilrsat
Its telling you that the register_globals option in your php.ini file is set to 0 or false.

I'd guess that in your previous folders there was either an .htaccess file or right in the main apache config something like this:

"php_value register_globals 1"

So the quick fix is to stick a .htaccess file in that new folder with that line in it. The longer fix involves deciding if enabling register_globals is a good idea (common practice is that register_globals is *not* a good thing), and if not, fixing your php code so it doesn't depend on it. If you decide it is a good idea, then enabling it in the php.ini file means you don't have to fiddle with enabling it in multiple places.

So if I just dump a .htaccess file into all the subdirectories of the directory that I'm working with, all I have to include is just the line "php_value register_globals 1" right?

Should only need to put it in the root directory of the website. .htaccess cascades to subdirs automatically.