RE: [PHP] Re: How to set register_globals=off in the script?
| From: | Michael Sims | Date: | Tue, 21 Dec 2004 23:32:53 +0000 |
| Subject: | RE: [PHP] Re: How to set register_globals=off in the script? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204895@lists.php.net to get a copy of this message | ||
Jason Barnett wrote:
>> So I want to keep PHP register_globals=on in php.ini, but in local
>> files set to off?
>>
>> How I can do this?
>
> You can change this, and other php.ini directives, with the PHP
> function ini_set
register_globals cannot be changed with ini_set(). It is of type "PHP_INI_PERDIR"
meaning that it can only be changed in the php.ini, .htaccess, or httpd.conf. See:
http://www.php.net/manual/en/function.ini-set.php
Personally I prefer to set register_globals=off in php.ini, then use an .htaccess
file to turn it on only for those applications that absolutely require it to
function. That way new applications default to register_globals=off. IOW, I prefer
to have to take specific action to open up potential security holes rather than
having to take specific action to close them. YMMV...