1

I'm using Fat Free Framework 3.5 on Php 5.6 and can't get rid of the error:

Fatal error: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead.

On a shared host, I don't have access to the php.ini file.

Google told me I could add this to my .htaccess

<IfModule mod_php5.c>
    php_flag always_populate_raw_post_data -1
</IfModule>

but that didn't do anything.

I've changed all instances of

$f3->get("BODY")

to

file_get_contents('php://input')

but this doesn't seem to help either.

What gives? How do I fix this?

nicholas
  • 14,184
  • 22
  • 82
  • 138
  • 1
    [This answer](http://stackoverflow.com/a/37801316/3585500) says the cause is an empty POST and to add a filler parameter. – ourmandave Jul 09 '16 at 20:33
  • No, that's not the problem. I'm posting JSON in the request body. Everything works alright if I change Godaddy to php v5.5 instead of 5.6. – nicholas Jul 10 '16 at 00:47
  • 2
    It's not a Fat Free Framework problem. Whenever you will send a JSON AJAX request to a PHP 5.6 with php.ini settings like yours, you will get a response like that. You need to either change php.ini or send the data in AJAX using POST values. Or, if it is a production environment, you should hide all errors (which you should do anyway on prod): https://secure.php.net/manual/en/function.error-reporting.php – george007 Jul 10 '16 at 15:02

2 Answers2

0

grab the latest dev-branch and try to disable the startup error checks to get rid of this error message. maybe it helps. follow the sample here: https://github.com/bcosca/fatfree-core/pull/125

ikkez
  • 2,052
  • 11
  • 20
0

The answer seems to be: don't use godaddy hosting. I switched over to a Heroku php instance and everything works flawlessly.

nicholas
  • 14,184
  • 22
  • 82
  • 138