Married, moved, and getting it together.

Turn off Magic Quotes in PHP via .htaccess 2007 Feb 15

#.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.

Joe Crawford blogged this at 6:59pm in 2007 in February. The 15th was a Thursday. You are reading this 11 years later. Make a public comment. There are 5 comments Tweet. Direct message. Send email. It has hashtags→ .

Comments: 5

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

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?

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

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

Comments Open; Trackbacks Open.