What is magic_quotes_gpc?
PHP is a programming language that runs many websites. magic_quotes_gpc was an old PHP feature. It put a backslash in front of quote marks in form data. So It's became It\'s.
It was meant to protect sites, but it caused many problems. PHP removed it in version 5.4. Newer PHP versions do not have this setting at all.
Option 1: use cPanel
cPanel is the control panel where you manage your hosting.
- Log in to cPanel.
- Open MultiPHP INI Editor or Select PHP Version.
- Find the option
magic_quotes_gpc. In Select PHP Version it is under Options. - Set it to Off.
- Save your change.
If you cannot see the option, your PHP version is too new to have it. Or your host does not show it. You can ask Hostvento support.
Option 2: use a php.ini file
A php.ini file holds settings for PHP.
- Open File Manager in cPanel.
- Go to the folder of your website, often called
public_html. - Look for a file named
php.ini. If it does not exist, create one with + File. - Right-click the file and choose Edit.
- Add this line.
magic_quotes_gpc = Off
This tells PHP not to add backslashes to form data.
- Save the file.
Option 3: use .htaccess
A .htaccess file is a small settings file for the Apache web server. This only works on some setups.
- Open
.htaccessin thepublic_htmlfolder. It is a hidden file, so turn on Show Hidden Files in the File Manager settings. - Add this line at the bottom.
php_flag magic_quotes_gpc Off
This switches the setting off for your site.
- Save the file and reload your site.
Quick recap
- magic_quotes_gpc adds backslashes to quotes in form data.
- It is old and was removed in PHP 5.4.
- Switch it off in cPanel, php.ini or .htaccess.
- The best long-term fix is a newer PHP version.