3

I am trying to upgrade Magento 2.07 to 2.1. I pass all the checks apart from the one below:

Your PHP Version is 5.6.22, but always_populate_raw_post_data = 0. $HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0. This will stop the installer from running. Please open your php.ini file and set always_populate_raw_post_data to -1. If you need more help please call your hosting provider.

I had this problem on setup and got around it by editing my .user.ini by adding

always_populate_raw_post_data = -1

But this seems to be ignored by the upgrade utility. Any ideas? I am thinking it might be because my cron jobs are loading the server php.ini and not my .user.ini?

  • what does phpinfo() say? I have the same problem and if i check phpinfo() I see always_populate_raw_post_data -1 for both Local Value and Master Value.. but i still get the same error you get – mrzhero Jun 30 '16 at 7:22
  • 1
    Hi @mrzhero my phpinfo() says -1 for the local value. Which works perfect for the initial Magento 2 install. But the upgrade system seems to ignore this, possible bug I think. Since my store isn't very big I've just set up a fresh install of 2.1 and going to import everything in rather than keep pulling my hair out trying to get it to update. – caffeinehigh Jun 30 '16 at 20:03
  • 1
    You can try adding this to Magento's .htaccess: php_value always_populate_raw_post_data = -1. Issues like yours happen because there are typically at minimum two sets of PHP configurations: one for the PHP CLI and one for the web server. In addition, if you have multiple PHP versions installed, it gets more complicated. – Steve Johnson Jul 1 '16 at 16:16
  • @Steve Johnson I tried, still no luck. I made a test file that prints the output of $iniSetting = intVal(ini_get('always_populate_raw_post_data'));: the result is -1. When I run the Readiness Check however, it says always_populate_raw_post_data = 0. – mrzhero Jul 13 '16 at 14:59
0

Found the problem on my server.

Check phpinfo() on your browser.

Check php -i | grep php.ini via SSH.

Compare the value of Loaded Configuration File: on my server, they were 2 different files. My host provider said they could change only the file I saw in phpinfo() and not the other one. Since Magento checks the value by running cron, it gets the configuration that I can't change.

So the only way for me was to bypass the checker.

I edited {magento_root}/setup/src/Magento/Setup/Model/PhpReadinessCheck.php:

private function checkPopulateRawPostSetting(){
    // HHVM and PHP 7does not support 'always_populate_raw_post_data' to be set to -1
    if (version_compare(PHP_VERSION, '7.0.0-beta') >= 0 || defined('HHVM_VERSION')) {
        return [];
}

return []; // <- THIS IS THE LINE I ADDED

[...]

After the cron jobs get executed, if you check {magento_root}/var/.setup_cronjob_status, you should see:

"php_settings_verified": {
        "responseType": "success",
        "data": []
    }

Run again the Readiness Check: the PHP Settings Check gets a green light.

Dirty workaround, but I don't know what else I can do.

  • Dirty workaround, yes. Since you're running Mage 2, why not use PHP 7.0 instead? They can run side-by-side like PHP 4 and 5 did for years on hosts. – Brett Jun 30 '17 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.