I've tried to find a solution for this myself but solutions to other 406 problems haven't helped me.
I have enabled PHP and the Apache web server on my Mac. I have found that if I pass a request (POST or GET) with the Accept: header set, then it fails with a 406 error:
$ curl -X GET -H "Accept: application/json" http://localhost/test/tester
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>406 Not Acceptable</title>
</head><body>
<h1>Not Acceptable</h1>
<p>An appropriate representation of the requested resource /test/tester could not be found on this server.</p>
Available variants:
<ul>
<li><a href="tester.php">tester.php</a> , type application/x-httpd-php</li>
</ul>
</body></html>
However, if I exclude the "Accept: application/json" the request executes without error.
I tried adding this test/tester.var (in the same dir as test/tester.php):
URI: tester
Content-type: application/json
URI: tester.php
My intention was to direct Apache to handle request with "Accept: application/json" by executing tester.php. But it hasn't helped me (I also added 'AddHandler type-map .var' under 'IfModule mime_module' inside my httpd.conf file and restarted the server).
'mod_security' doesn't appear to be configured, but I added the following .htaccess to my test/ directory anyways:
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
These are solutions that I found on the net by none have worked for me.
Any ideas?