0

How do I change the property magic_quotes_gpc = On to magic_quotes_gpc = Off in the web.config file? It's a server with IIS, and I can not edit the PHP.ini.

I tried adding the below to the htaccess.txt file, but it doesn't work.

php_flag magic_quotes_gpc Off
php_value magic_quotes_gpc Off
Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
Rui Martins
  • 3,337
  • 5
  • 35
  • 40
  • 1
    advice: DON'T turn it on. magic_quotes was pretty much the single greatest MORONIC design decision in PHP history. Leave it off, forget it ever existed. – Marc B Apr 25 '13 at 16:09

2 Answers2

3

This will also work (in PHP)

ini_set('magic_quotes_gpc', 'Off');
ex3v
  • 3,518
  • 4
  • 33
  • 55
  • Thank you, The problem is that it was to install Joomla on this server, but does not work. I have already contacted the 'AMEN.pt' (host) to help me change the flag in the php.ini file, or they migrate to service to linux because in linux (amen.pt) I can change the php.ini. – Rui Martins Apr 26 '13 at 17:21
2

Don't trust magic_quotes_gpc, magic quotes option was introduced to help protect developers from SQL injection attacks. It effectively executes addslashes() on all information received over GET, POST or COOKIE. Unfortunately this protection isn't perfect: there are a series of other characters that databases interpret as special not covered by this function. In addition, data not sent direct to databases must un-escaped before it can be used.

chandresh_cool
  • 11,753
  • 3
  • 30
  • 45