Forum Moderators: coopster
I am facing a little problem, on my server php is configured with register_globlas off setting, but now i want to on this setting, i used ini_set("register_globals","On"); command to on this setting but stillit is off. Can any body guide me how i can make this settingon.
I also used .htaccess file to on this -
php_flag register_globals on
php_value register_globals 1
but both are not working.
Please help me to short out this problem.
Warm Regards,
Vineet
also if you are writing a general use application then it is always a better practice to use Globar Arrays to get variables i.e $_GET, $_POST etc etc. ..
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.
If you can, set it in your php.ini.
Also note that you should be careful when turing register_globals on. Read this [us2.php.net] for more information on what to look out for!
Good luck!
Thanks for your information. Means my .htaccess code is fine but as per you my host is not supporting this so i will not be able to change this setting? right? so in this case what i can do to turn it on.
One more question, it means we can't update ini settings in run time?
I also don't like to work with register_globals on setting, but due to some reason i have to use this.
Regards & thanks,
Vineet
I also don't like to work with register_globals on setting, but due to some reason i have to use this.
You don't have to do anything you don't want to do.
If you want to call globals easily, you could always extract() them.
extract($_GET);
extract($_POST);
Then, they can be used in the same manner as with register globals on.