Forum Moderators: coopster

Message Too Old, No Replies

Cannot turn off magic quotes

         

d40sithui

3:09 pm on Apr 1, 2008 (gmt 0)

10+ Year Member



Tried to do it in php.ini and also .htaccess. neither works. using this script to test. always echos on. any other elements that could be messing with this?

<?
if(get_magic_quotes_gpc()){
echo "on";
}

else{
echo "off";
}

?>

 this is in php.ini
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = off

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = off

; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = off

 and this is in .htaccess (whole file)
php_flag magic_quotes_gpc Off
AddType video/avi .avi
AddType video/mpeg .mpeg
AddType video/wmv .wmv

penders

11:24 am on Apr 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you've edited php.ini do you need to restart PHP/Apache?

Is it case-sensitive? If so, try 'Off' (capital 'O') - as you have in your .htaccess file.

Also seen mentioned, if "php_flag" doesn't work in .htaccess, try "php_value" instead?
PHP Manual: Disabling Magic Quotes [uk2.php.net]

d40sithui

2:23 pm on Apr 3, 2008 (gmt 0)

10+ Year Member



see the funny thing is, turning off magic quotes works flawlessly on one of my servers. a simple edit to the php.ini and bam (no restartts required)!
however, there's something going on with this other server thats either not reading the php.ini or something...idk.
so now i'll go through my filter function and write the "if gpc quotes are on do this, otherwise do that." just until i figure out what's going on. if ever =/.
thanks for the reply.

NameNick

9:23 pm on Apr 10, 2008 (gmt 0)

10+ Year Member



You could always loop through the super globals and do a stripslashes().

NN

henry0

9:57 pm on Apr 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



see the funny thing is, turning off magic quotes works flawlessly on one of my servers. a simple edit to the php.ini and bam (no restartts required)!
however, there's something going on with this other server thats either not reading the php.ini or something...idk.

It does not work that way
probably when you hit save then it auto-restart Apache

second part: "not reading the php..."
you are not editing the good one
depending on server setup you might see a few php.ini
sym link etc...
so you'll be better of asking your ISP
for that php.ini location.

kele56

3:59 am on Apr 11, 2008 (gmt 0)

10+ Year Member



I'm agree with what henry0 say

vincevincevince

4:02 am on Apr 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check php_info() and see which php.ini file was loaded. Failing that, if it's a local server, upgrade PHP to 6 (not suitable for production environments yet) where you'll find gpc_magic_quotes to be entirely removed.

coopster

12:09 pm on Apr 11, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It does not work that way

Actually, it depends on the installation. Take CGI for example. Some hosting providers use a cgi-wrapper for every PHP request. Details on the Runtime Configuration [php.net] page.

d40sithui

2:57 pm on Apr 11, 2008 (gmt 0)

10+ Year Member



hey i did the phpinfo() thing. guess what? it turns out it was loading a totally different php.ini file. WEAK! lol. havent been able to change that since i do not have root access yet =/.
thanks to all that have contributed, especially mr vince!