always_populate_raw_post_data disabled? here’s a workaround

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

  • best self written PHP function. ever.
  • why vTiger sucks
  • Rotating signature dot com
  • hostgator upgrades all their servers to PHP & MySQL 5
  • All cities of Belgium with postal code and GPS location
  • 

    2 Responses (Add Your Comment)

    1. 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.

    2. Thanks for the workaround. Ran into this strange issue today and was able to solve it quickly thanks to you :)

    Leave a Reply

    Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    Archives

    Twitter!