Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn register_globals on for just one app

We've got a client application that relies on register_globals turned on to work, but we're hosting it on a our shared server, and don't want to turn register_globals on in our main php.ini file.

I tried inserting ini_set ( 'register_globals' , 'On' ); but it didn't work. Why didn't it? And is there a better way?

like image 395
Yarin Avatar asked Dec 12 '22 05:12

Yarin


2 Answers

You could always try to put:

 extract($_REQUEST,EXTR_SKIP); //thanks @Wayne Whitty

on top of every files. It would yeld the same results as far as I know. But really, REALLY, its bad bad bad to use these. I'd look for a way to change the code. But sometimes you have no choice.

like image 194
Iznogood Avatar answered Dec 26 '22 22:12

Iznogood


From the php documentation:

Please note that register_globals cannot be set at runtime (ini_set()). Although, you can use .htaccess if your host allows it as described above. An example .htaccess entry: php_flag register_globals off.

link to php documentation on register_globals

like image 22
itsmequinn Avatar answered Dec 26 '22 21:12

itsmequinn