PHP:magic_quotes_gpc can not start

1.1k views Asked by At

I set the "magic_quotes_gpc" with the value "on" in php.ini,just like the following:

; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/magic-quotes-gpc
magic_quotes_gpc = On

but it seems doesn't work and I test this with the following php code:

if(!get_magic_quotes_gpc()){
    echo "hello world<br />";
}

it will always print "hello world",whether it is "on" or "off". addition,I use wampserver 2.4 in my computer!

2

There are 2 answers

1
SáT On BEST ANSWER

WampServer 2.4 comes with PHP 5.4, and as the docs say, get_magic_quotes_gpc() always returns false since PHP 5.4.0, for the (horrible) feature was removed from the language. You can't have magic_quotes.

0
Nick Tsai On

First, you can check your PHP version:

Magic Quotes has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

If you want to implement magic_quotes_gpc on PHP 5.4 above version, you could use yidas/magic-quotes which works the same as magic_quotes_gpc.

https://github.com/yidas/php-magic-quotes