Turn register_globals off on shared server
Posted: Tue May 24, 2005 10:55 pm
I teach a basic web design class at my high school and I include a bit of PHP. On our shared hosting site, register_globals is turned on. I'd like to turn it off to force my student into coding for that sort of environment. I did some research on the PHP site and found this:
Comments? Hints? Suggestions? Thanks in advance!
The directions seem straight forward enough, but I have no experience with configuring PHP by any method and I'm wondering if there's anything else I should be considering or worried about.If you're under an Apache environment that has this option enabled, but you're on shared hosting so have no access to php.ini, you can unset this value for your own site by placing the following in an .htaccess file in the root:
php_flag register_globals 0
The ini_set() function actually accomplishes nothing here, since the variables will have already been created by the time the script processes the ini file change.
And since this is the security chapter, just as a side note, another thing that's helpful to put into your .htaccess is:
<Files ".ht*">
deny from all
</Files>
Comments? Hints? Suggestions? Thanks in advance!