Can I add php_value magic_quotes_gpc off to .htaccess?

Tag: .htaccess Author: cc13069166166 Date: 2009-08-27

My current .htaccess has the following.

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

Can I add the following to .htaccess?

php_value include_path ".;C:/xampp/htdocs/phpweb20/include"
php_value magic_quotes_gpc off
php_value register_globals off

Other Answer1

First of all, magic_quotes_gpc being a boolean configuration, you should use php_flag, instead of php_value.

See How to change configuration settings, about that -- and note that it will only work if PHP is used as an Apache module, not as a CGI.

Considering magic_quotes_gpc can be changed PHP_INI_PERDIR, it might work... Once again, if you are running PHP as an Apache module.


Then : did you try ? That's the best way of knowing, I'd say ;-)

If it's not working : it might depend on your hosting service -- maybe they have some support that could help you about that ?

For instance, with my hosting provider (ovh.com), which is running PHP as CGI, and not Apache module, I have to use something like this to activate magic_quotes_gpc -- which probably means the opposite to de-activate :

SetEnv MAGIC_QUOTES 1

But that clearly depends on your hosting service...