Knowledge Base
MilesWeb / How-Tos

How to enable/disable Magic Quotes GPC ?

Approx. read time : 2 min

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 web hosting plans you can enable/disable it in php.ini file.

With over 10+ years of experience in the web hosting industry, I have achieved extensive exposure to result-oriented methodologies. And expertise in different domains like Datacentre Services, Cloud computing technology, Web hosting industry and many more.