Turning off magic quotes in PHP doesnt seem to work
<p>I am trying to turn magic quotes off in PHP but cannot get it to disable - I have set the below in /usr/local/lib/php.ini and restarted Apache but it has made no difference.</p>

<pre><code>; Magic quotes

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off

; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off
</code></pre>

<p>phpinfo confirms these are all set to Off.</p>

<pre><code>magic_quotes_gpc Off Off
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
</code></pre>

<p>I then tried adding</p>

<pre><code>php_flag magic_quotes_gpc off 
</code></pre>

<p>to htaccess but that gives a 500 Internal Server error - looking in error_log there is nothing added to tell me why this might be happening.</p>

<p>Server is running Centos 5.8 64 bit with CPanel/WHM and the front end is Wordpress with a custom PHP application in the background. PHP version is 5.3.18 and Loaded Configuration File is /usr/local/lib/php.ini</p>

<p>The reason I think it is not working is that the following message which is pulled from MySQL where it had mysql_real_escape_string, addslashes and htmlspecialchars applied to it before adding to the database.</p>

<p>The original message is:</p>

<pre><code>This is a "how to" question. I don't think it is covered in the notes - sorry if I've missed it. 
</code></pre>

<p>It gets added to MySQL as:</p>

<pre><code>This is a &amp;quot;how to&amp;quot; question. I don\'t think it is covered in the notes - sorry if I\'ve missed it.
</code></pre>

<p>When it is then displayed on the screen it displays as:</p>

<pre><code>This is a \\"how to\\" question. I don\\\'t think it is covered in the notes - sorry if I\\\'ve missed it. 
</code></pre>

<p>And when stripslashes is then applied to this, it becomes:</p>

<pre><code>This is a \&amp;quot;how to\&amp;quot; question. I don\'t think it is covered in the notes - sorry if I\'ve missed it. 
</code></pre>

<p>What am I doing wrong or what else can I try?</p>
