<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>vijayjoshi.org &#187; htaccess</title>
	<atom:link href="http://www.vijayjoshi.org/tag/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vijayjoshi.org</link>
	<description>php &#124; javascript &#124; ajax &#124; and all things web</description>
	<lastBuildDate>Sun, 20 Nov 2011 15:24:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP &#8211; Turn register globals on off using htaccess</title>
		<link>http://www.vijayjoshi.org/2009/06/05/php-turn-register-globals-on-off-using-htaccess/</link>
		<comments>http://www.vijayjoshi.org/2009/06/05/php-turn-register-globals-on-off-using-htaccess/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 10:59:37 +0000</pubDate>
		<dc:creator>Vijay Joshi</dc:creator>
				<category><![CDATA[FAQ]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://www.vijayjoshi.org/?p=347</guid>
		<description><![CDATA[
			
				
			
		
Problem:
My application is hosted on a server where php has register_globals set to on in php.ini. But using register_globals = on makes code error prone and is dangerous to use.
I want to turn it of for my application regardless of what is its setting for other applications.
Since the value of register_globals cannot be set at run time bu using ini_set, ...]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2009%2F06%2F05%2Fphp-turn-register-globals-on-off-using-htaccess%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.vijayjoshi.org%2F2009%2F06%2F05%2Fphp-turn-register-globals-on-off-using-htaccess%2F&amp;source=v08i&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>Problem:</strong></p>
<p>My application is hosted on a server where php has register_globals set to on in php.ini. But using register_globals = on <a title="Register Globals Secutiry" href="http://in.php.net/manual/en/security.globals.php" target="_blank">makes code error prone and is dangerous to use</a>.<br />
I want to turn it of for my application regardless of what is its setting for other applications.<br />
Since the value of register_globals cannot be set at run time bu using ini_set, how can I do it?</p>
<p><strong>Solution:</strong></p>
<p>Use htaccess file to control this behaviour. Create a file named .htaccess in root directory of your application and write the following line in it:</p>
<pre class="brush:php">php_flag register_globals off</pre>
<p>Thats all you need to do.</p>
<p>You can verify this by creating a phpinfo() file. Suppose your server has register_globals set to on and you have turned it off using above syntax.</p>
<p>phpinfo() will show the local value as off and master value as on.</p>
<p>Note: Of course, this will work only if your apache configuration allows to override htaccess settings.</p>
<div class="shr-publisher-347"></div><!-- Start Shareaholic LikeButtonSetBottom --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:right;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.vijayjoshi.org%2F2009%2F06%2F05%2Fphp-turn-register-globals-on-off-using-htaccess%2F' data-shr_title='PHP+-+Turn+register+globals+on+off+using+htaccess'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://www.vijayjoshi.org/2009/06/05/php-turn-register-globals-on-off-using-htaccess/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

