Magento – Magento 2: System upgrade fails Readiness Check (always_populate_raw_post_data = 0)

cronmagento2upgrade

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?

Best Answer

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.

Related Topic