homepage Welcome to WebmasterWorld Guest from 54.211.73.232
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Http 406 error alert box on each page of site
406 error on php based ecom site
compose

5+ Year Member



 
Msg#: 3548539 posted 12:44 pm on Jan 15, 2008 (gmt 0)

Hello,

Before posting this post i have searched Werbmasterworld, but did not found any solution :( except explanation of error code, so i am putting my problem here.

My site was running fine yesterday, and today suddenly it is flashing Http 406 error message. I did not make any changes in code today, i am not able to trap what's the issue. Can any one please help me in solving this issue.

406 error message is appearing in alert box so i guess error is coming in any ajax file.

Regards,
Vinic

 

PHP_Chimp

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3548539 posted 1:17 pm on Jan 15, 2008 (gmt 0)

The problem may be coming from the server. As if the server/php setting have been changed then you may not be sending the same content headers as yesterday.

Have you had a look at the -
Accept:, Accept-Charset:,Accept-Encoding: ,Accept-Language:, Accept-Ranges:

and the respective Content-* headers coming from the server?
To see if there is anything in there that should not be there.

Are you also sure that no one else has been working with your code?

compose

5+ Year Member



 
Msg#: 3548539 posted 3:14 pm on Jan 15, 2008 (gmt 0)

Thanks PHP_Chimp for your reply. Sorry but can you please tell me how to check "Accept:, Accept-Charset:,Accept-Encoding: ,Accept-Language:, Accept-Ranges:"

Actually site pages are loading properly but after page load a javascript alert box is coming showing this message

"
<!DOCTYPE HTML PUBLIC "//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>406 Not Acceptable</TITLE>
</HEAD><BODY>
<H1>Not Acceptable</H1>
An approppriate representation of the requested resource /incdex.php could not be found on this server.<p>
<HR>
<ADDRESS>Apache/1.3.39 Server at example.com Port 80</ADDRESS>
</BODY></HTML>
"

So is this server problem?

[edited by: eelixduppy at 6:46 pm (utc) on Jan. 15, 2008]
[edit reason] exemplified [/edit]

PHP_Chimp

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3548539 posted 5:46 pm on Jan 15, 2008 (gmt 0)

The accept range of headers are sent by your browser to tell the server what your browser can accept. So to look at these and the returned Content headers you would need a tool to look at the raw http headers.
If you use Firefox then there is an extension called liveheaders that lets you look at these.

As you may find that when you look at the Content- headers returned by the page giving you the 406 that there is something wrong...like someone misspells and puts Content-Type: text/hmtl - as opposed to text/html. As your browser didnt ask for any text/hmtl you get a 406 error.
It may not be that simple, but it is worth checking.

compose

5+ Year Member



 
Msg#: 3548539 posted 8:02 pm on Jan 15, 2008 (gmt 0)

Thanks PHP_Chimp i will check it, One point i was thinking, it can be problem of mod_security = on? as i am on shared server i am not able to change it's value. I have tried to change it using htaccess but still value of mod_security is not changed.

What's your opinion on this.

compose

5+ Year Member



 
Msg#: 3548539 posted 8:31 pm on Jan 15, 2008 (gmt 0)

Hi Php_chimp,

Problem is sloved out, it was due to mod_security on, i have changed it to off using this code in htaccess file and now site is running fine.

"SecFilterEngine Off
SecFilterScanPOST Off"

I guess server settingw as changed to stop spammers or any other security reason.

Thanks for your kind help and prompt replies.

encyclo

WebmasterWorld Senior Member encyclo us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3548539 posted 8:31 pm on Jan 15, 2008 (gmt 0)

Are you using content negotiation (MultiViews)? If not, try disabling it with the following in the root-level .htaccess file:

Options -MultiViews

Also, make sure you're using AddHandler not AddType for files to be parsed by PHP:

AddHandler application/x-httpd-php .php

If you use AddType then the PHP file will have the MIME type application/x-httpd-php rather than text/html, and the former is not in the Accept list of your request, hence the 406.

There are some earlier threads about Apache/PHP and 406 errors here which you might find useful:

[webmasterworld.com...]
[webmasterworld.com...]

This may fix your problem without having to disable mod_security.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved