|Change settins in .ini file|
register_globals valus is not changing
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.
ini_set() function changes the .ini values only for your script's life time i.e as soon as your script dies the changes implemented using ini_set are removed and they dont affect .ini settings permanently..
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!
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,
|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.
Then, they can be used in the same manner as with register globals on.
Thanks a lot bridman, now it's working.
Thanks all for your time, and input.