This question already has an answer here:
I have in shared server magic_quotes_gpc
is on. I have tried adding the following code to my .htaccess
file.
php_flag magic_quotes_gpc Off
When I use the above line in .htaccess
, it throws 500 internal server error.
Even I've tried using ini_set
too.
The problem is with CKEEditor. It addslashes the double quotes. And the editor is not woeking properly. I have gone through several answers also but not getting the answer properly.
Please guide me.
PHP Version: 5.3.24
</div>
According to the docs, the magic_quotes_gpc
directive is PHP_INI_PERDIR
so you should be able to change it.
Whenever you see a "500 Internal Server Error" status code in your live server you should head to the log files and find out the exact reason (rather than guessing). Whatever, I suspect that Apache is complaining that the php_flag
directive is unknown. If that's the case, your PHP interpreter is not running as Apache module, thus you cannot use Apache files to change it.
Since your hosting account seems to be pretty old, you'll probably have a custom php.ini
file somewhere in your FTP account.
If you can't disable magic quotes by any means, use the example code from the PHP manual as a workaround to strip the extra slashes: http://php.net/manual/en/security.magicquotes.disabling.php:
if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = stripslashes($v);
}
}
}
unset($process);
}