Change magic_quotes_gpc & register_globals PHP


#1

Hi,

I’m having some issues with changing the PHP magic_quotes_gpc & register_globals config.
I’m trying to use PHP5 and create 2 files in the subdir of my software:

.htaccess
php_value register_globals 0
php_flag register_globals off
php_value magic_quotes_gpc 1
php_flag magic_quotes_gpc on

and create a php.ini :

register_globals off
magic_quotes_gpc on

None of the option works either w/ Web security enabled or disabled in my domain config. How do I change that ?

Thanks,
-M


#2

register_globals is already off with PHP 5. You should be able activate magic quotes in your .htaccess file with:php_flag magic_quotes_gpc onWhich is what you thought. A much better solution is to handle the quotes manually, with addslashes() and stripslashes(). If you are going to be wacking something into MySQL, you will get better results with mysql_real_escape_string() instead.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

You should be able activate magic quotes in your .htaccess file

Only if he’s using mod_php, which isn’t an option with PHP 5.

I agree with your recommendation against using magic_quotes, but if he must have it enabled, he’ll have to set it via ini_set().


If you want useful replies, ask smart questions.


#4

Does the AddHandler application/x-httpd-php .php trick not work with PHP5 then?


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#5

That maps the given file extention to a single Apache module, and we already know it uses mod_php4.

If I were to guess at how to make this work with PHP 5, I might try using application/x-httpd-php5, but given DH’s preference for PHP-CGI, it’s unlikely to work. I doubt mod_php5 is even installed.


If you want useful replies, ask smart questions.


#6

Thanks for the answers … But I still cannot setup magic quotes on. I’m now on apache 2, php5. Is there anyway I can copy php.ini and tell php to use my local php.ini config so it’ll work out alright ?

Thanks