Married, moved, and getting it together.


February 15th, 2007

Turn off Magic Quotes in PHP via .htaccess

#.htaccess SETTINGS TO TURN OFF
# STUPID MAGIC QUOTES IN PHP
# I HATE MAGIC QUOTES PROBLEMS
php_flag magic_quotes_gpc off

UPDATE: See Magic Quotes, and note:

This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.


Comments: 5

bobou

April 23, 2008 12:22am

In ovh, You can do the following instead of php_flag:

SetEnv MAGIC_QUOTES 0

Below is the forum in french:

Modification des valeurs grâce à l’instruction SetEnv

Il est désormais possible de modifier les valeurs de register_globals, magic_quotes, Zend Optimizer ainsi que choisir entre php4 et php5 grâce à l’instruction SetEnv via un fichier .htaccess que vous pouvez créer dans un répertoire donné de votre site via le bloc note sous windows ou tout autre éditeur de texte.

Exemple:

SetEnv REGISTER_GLOBALS 0
SetEnv ZEND_OPTIMIZER 1
SetEnv MAGIC_QUOTES 1
SetEnv PHP_VER 5

Tim

October 17, 2009 12:10am

Thank you! You just helped me out of a huge hole! : )

Prodajem kupujem

November 21, 2012 4:10pm

After I put this code in. Htaccess site is not working and shows error 500. What could be the problem?

Joe Crawford

November 21, 2012 5:05pm

You would need to look at the Apache error.log to see the nature of the error.

debnath

July 9, 2013 10:42pm

Turn off Magic Quotes in PHP via .htaccess

    #.htaccess SETTINGS TO TURN OFF  
    # STUPID MAGIC QUOTES IN PHP  
    # I HATE MAGIC QUOTES PROBLEMS  
    php_flag magic_quotes_gpc off

This code is work fine
many many thanks boss…

Leave a Reply