Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  How-Tos  >  How to Enable/Disable Magic Quotes GPC?
Top Scroll

How to Enable/Disable Magic Quotes GPC?

 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.

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.