Not magic quotes, but slashes are being added on live server

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Not magic quotes, but slashes are being added on live server

Post by jaoudestudios »

For some reason the same code on my production server is getting slashes added, but magic quotes are off on dev and live.

Any ideas what it could be?
terier
Forum Newbie
Posts: 9
Joined: Sat Jun 20, 2009 4:58 am

Re: Not magic quotes, but slashes are being added on live server

Post by terier »

Try to have a look if for some reason magic quotes gets enabled "locally" instead of server-wide.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Not magic quotes, but slashes are being added on live server

Post by jaoudestudios »

Nope, looks fine.

Plus it works fine on my dev server (the exact same code) which is pretty much the same - but obviously a small difference, just cant figure out what it is :?

Does anything else control addslashes?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Not magic quotes, but slashes are being added on live server

Post by Eran »

Run this just before you run the code that is under suspicion to make sure:

Code: Select all

var_dump( get_magic_quotes_runtime() );
var_dump( get_magic_quotes_gpc() );
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Not magic quotes, but slashes are being added on live server

Post by jaoudestudios »

pytrin wrote:Run this just before you run the code that is under suspicion to make sure:

Code: Select all

var_dump( get_magic_quotes_runtime() );
var_dump( get_magic_quotes_gpc() );
Thank you pytrin, we now have a clue, but not sure what it means.

On my dev server I get...
int(0) int(0)
But on live I get...
int(0) int(1)
So var_dump( get_magic_quotes_gpc() ); is returning true. I am using Zend Framework.

What does this mean?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Not magic quotes, but slashes are being added on live server

Post by Eran »

It means that magic_quotes is on, either via the php.ini or via .htaccess. find it and destroy it
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Not magic quotes, but slashes are being added on live server

Post by jaoudestudios »

I just cant find it. Nothing in php.ini or .htaccess files

The only difference between my 2 servers is that my live server is using plesk.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Not magic quotes, but slashes are being added on live server

Post by Eran »

is using plesk
yikes. I guess this is shared hosting? or do you have a VPS?
many server configuration have several .ini files for PHP that extend the original .ini file. It's possible one of those adds the magic_quotes directive. You might want to grep for it
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Not magic quotes, but slashes are being added on live server

Post by jaoudestudios »

pytrin wrote:
is using plesk
yikes. I guess this is shared hosting? or do you have a VPS?
Nope its a dedicated box.
pytrin wrote:
is using plesk
many server configuration have several .ini files for PHP that extend the original .ini file. It's possible one of those adds the magic_quotes directive. You might want to grep for it
Yep I did a grep already to check all the additional *.ini files, but still nothing.

Could it be a mysql setting?
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Not magic quotes, but slashes are being added on live server

Post by jaoudestudios »

My next dedicated will be pure linux and no plesk. :wink:
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Not magic quotes, but slashes are being added on live server

Post by jaoudestudios »

I could not find the little s**t!

I have just turned off magic quotes in the .htaccess file - probably best as it wont give me issues server to server.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Not magic quotes, but slashes are being added on live server

Post by VladSun »

Have you tried:

Code: Select all

# grep -R magic_quotes /
:)
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Not magic quotes, but slashes are being added on live server

Post by jaoudestudios »

I did, but it took too long so stopped it.

But I should leave it running to find out where the issue is.
Post Reply