Re: How to set register_globals=off in the script?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 21 Dec 2004 14:56:03 -0500, Jerry Swanson <pmysql@xxxxxxxxx> wrote:

> I know that "register_globals = on" is not secure. But one program
> requires to use register_globals=on. So in php.ini register_globals is
> set to on.
> 
> I have PHP 5.1, is it possible in the code set register_globals=off
> for specific scripts.
> 

I'm afraid the answer is no, as the vars are globally set before
running the first line of your script, so this parameter cannot be
changed by code. But you can use some specific configurations if using
Apache as the webserver:

> So I want to keep PHP register_globals=on in php.ini, but in local
> files set to off?
> 
> How I can do this?

If your server is Apache, you can modify locally modify the settings
for a virtual server adding a line in the virtual server section in
your httpd.conf file (and have off in your php.ini)

php_flag   register_globals = 1

Don't forget to restart Apache after adding this line.

Also, you can set this line in the .htaccess file at the root
directory for any website, and it will modify the setting only for
that virtual server.

The httpd.conf option is best as it is parsed only when Apache start,
the .htaccess file is parsed for each file processed by the server.

Hope this helps,
Jordi.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux