Annoying Magic Quotes in PHP on Shared hosting

Written by Terence Chang on May 16th, 2007

In some case, the PHP4 configuration on Linux shared hosting will be default “ON” for magic_quotes_gpc. This cause the single and double quote will be escape with backslash (\). It doesn’t matter if you do addslashes or not.

So the magic_quotes_gpc has to be turned off. Tried the following in the .htaccess file. Put this file under the web root.


<ifModule mod_php4.c>
php_flag magic_quotes_gpc off
php_flag magic_quotes_runtime off
</ifmodule>

If it doesn’t work, them put the following php.ini file in every folders that is root of the script.

magic_quotes_runtime=off
magic_quotes_gpc=off
magic_quotes_sybase=off

 

Leave a Comment