How to enable/disable Magic Quotes GPC ?

Magic Quotes is a process that automatically escapes incoming data to the PHP script. This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. It’s preferred to code with magic quotes off and to instead escape the data at runtime, as needed.

You can enable/disable magic_quotes_gpc in php.ini & .htaccess depending on how php/apache are compiled.

1. Enable/disable using php.ini.
Copy server’s php.ini under your public_html. Find for magic_quotes_gpc. Set it to On OR Off as required.

Now, open .htaccess and add “SetEnv PHPRC /home/user/public_html”. Doing this, the php.ini will be used by all files & directories. Not just the main directory.

2. Enable/disable using .htaccess.
Adding the following line will disable it. Change from off to on if you want it to be enabled.

php_flag magic_quotes_gpc off

With our affordable hosting plans you can enable/disable it in php.ini file.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>