How to modify magic_quotes_gpc? Print

  • 31

Warning: "magic_quotes_gpc" is a configuration parameter that applies to PHP versions 5.4 and earlier. These versions are very old and you probably don't need the information contained on this page. Remember to check the version of PHP you are using before reading on.

To modify a parameter of your PHP configuration you have two possibilities depending on your configuration. To determine which method to use you must log into your Control Panel:

  1. In the"SOFTWARE" tab, click on the"Select a PHP version" icon;
  2. Once in the"PHP Selector", you will see the version and the mode currently activated under"Current PHP version" :
    • If you have a"native (X.Y)" version, which is the default configuration if you did not change this setting voluntarily, you will have to use a .htaccess file;
    • If you have selected another version (non-native), you can also use the"PHP Selector" interface of your control panel to be able to modify the PHP configuration of all your hosted sites at once.

For more detailed information about the impact of each configuration method, we invite you to read this other topic on this subject: How to change the PHP configuration?

.htaccess file

To change a PHP setting via an .htaccess file, you need to create a file named .htaccess in the root folder of your site or wherever the relevant scripts are located.

This file must contain a line with the parameter you want to modify, in this case:

php_flag magic_quotes_gpc Off

Selected version (non-native)

If you have selected another version than the native one, you can use the interface provided in your control panel to modify your settings, which will be valid for all your sites hosted in your account (unless the setting is defined in a .htaccess file). To do this, once you are logged into your :

  1. In the"SOFTWARE" tab, click on the"Select a PHP version" icon;
  2. Once in the"PHP Selector", right click on"Switch To PHP Options" and you will see the list of modifiable parameters;
  3. Click on the value of the"magic_quotes_gpc" parameter and select the new value that suits you best;
  4. Click on the "Apply" button that appears to the right of the value to validate your choice;
  5. Don't forget to click on"Save" at the bottom of the list so that your new configuration is applied.

Note: if the setting is not in the selector interface, you will have no choice but to use an .htaccess file as described above to change it.

Was this answer helpful?