I'm trying to develop a handler for virtual paths in Apache 2.4.2 and PHP 5.4.5 (loaded as a module), using the ErrorDocument
directive:
<Directory "...">
...
ErrorDocument 404 /handler.php
...
</Directory>
As far as the used method is GET or HEAD, it all works like a charm. Troubles come when the method is POST.
When using POST, in my test PC I manage to get the input stream via file_get_contents('php://input')
, even when the Content-Type
header is set to multipart/form-data
. In the server PC, the content is always empty, even when the type is application/x-www-form-urlencoded
.
I'm trying to get the raw POST data because $_POST
and $_FILES
are empty when the script is the result of this kind of redirection.
Is there something I'm missing? Maybe some different setting in the httpd.conf file? The php.ini file is the same. I just don't know where to begin.
UPDATE: it seems the difference was due to the action
attribute of the <form>
element I was using for testing purposes. Looks like the script is able to get the raw POST data when the action
is set to a .php
file and it's located in the root directory.
I guess this has something to do with the AddHandler
directive used in the httpd.conf file.