phpmagic-quotes-gpc

Can "magic_quotes_gpc" be enabled in PHP 5.3?


In PHP 5.3, can "magic_quotes_gpc" be enabled?

I understand that it is deprecated in PHP 5.3, but a PHP script I am installing requires this otherwise it won't work.


Solution

  • It has to be done at the .ini level. It can't be done within a script using ini_set(), because by the time the ini_set() is processed, PHP has already completed startup and the various superglobal arrays (POST/GET/REQUEST/etc...) have been set and will NOT be changed.

    You can enable the setting per-script using an Apache <Files> directive, since enabling magic quotes for all PHP scripts is a horrible idea:

    <Files needs_gpc.php>
       php_value magic_quotes_gpc 1
    </Files>