always_populate_raw_post_data disabled? here’s a workaround
February 11th, 2008 • php, snippets
Since HostGator does not support changing the value of always_populate_raw_post_data in PHP to “1″, I had to find a work around. After spending an hour Googling my issue and it turning zero-dot-zero results I was forced into being creative.
Appearantly you can use the input wrappers to go around this setting. Perhaps you could find this useful in the future
[snippet]<php
if(!$HTTP_RAW_POST_DATA){
$HTTP_RAW_POST_DATA = file_get_contents(‘php://input’);
if(empty($HTTP_RAW_POST_DATA))
{
// die here
}
}
[/snippet]
You might also want to look at these posts
2 Responses (Add Your Comment)
-
-
Thanks for the workaround. Ran into this strange issue today and was able to solve it quickly thanks to you
After spending an hour googling… I find this solution to my problem! Thanks! I was trying to adapt an existing script and it took ages to realise $HTTP_RAW_POST_DATA was empty because my server php.ini forbids it (and forbids changing the ini). I had to tweak ‘ to ” in the path to get the data.