|Http 406 error alert box on each page of site|
406 error on php based ecom site
| 12:44 pm on Jan 15, 2008 (gmt 0)|
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.
| 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?
| 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:"
<!DOCTYPE HTML PUBLIC "//IETF//DTD HTML 2.0//EN">
<TITLE>406 Not Acceptable</TITLE>
An approppriate representation of the requested resource /incdex.php could not be found on this server.<p>
<ADDRESS>Apache/1.3.39 Server at example.com Port 80</ADDRESS>
So is this server problem?
[edited by: eelixduppy at 6:46 pm (utc) on Jan. 15, 2008]
[edit reason] exemplified [/edit]
| 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.
| 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.
| 8:31 pm on Jan 15, 2008 (gmt 0)|
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.
I guess server settingw as changed to stop spammers or any other security reason.
Thanks for your kind help and prompt replies.
| 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:
Also, make sure you're using
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:
This may fix your problem without having to disable mod_security.