3

I got a big problem. When I first installed Magento I got the error set always_populate_raw_post_data to -1, which I did and it worked.

Now I am trying to install some sample data into Magento and for that, I need to install the plugin called Magento_CatalogSampleData. So when I am trying to install it I get the same error again that I got during the installation of the Magento application always_populate_raw_post_data to -1.

I have set it to always_populate_raw_post_data -1, both in the php.ini but also added php_value always_populate_raw_post_data -1 in the Apache2 config. But still get the same error during the readiness check.

How to solve this, I have no clue?enter image description here

  • You set always_populate_raw_post_data=-1 in php.ini, Are you restart Apache2 ? – Bill Dec 11 '15 at 8:32
  • Yes I have don that. I changed the php.ini in etc/php5/apache2 and have always_populate_raw_post_data 1 – Sadjad Johansson Dec 11 '15 at 8:34
  • I think your path with php.ini incorrect. You need using phpinfo() find path correct – Bill Dec 11 '15 at 8:50
  • Unfortunately it was the right path – Sadjad Johansson Dec 11 '15 at 9:36
  • What's you php version? – Yiorgos Moschovitis Dec 11 '15 at 10:09

11 Answers 11

5

As of PHP 5.6.0 always_populate_raw_post_data is deprecated and is commented out. So this value always equals 0 in php.ini

In order to override this you have two options

1. If you are using CGI/FCGI

Refer to your phpinfo(), find the value for 'user_ini.filename'. It should be sth like .user.ini or php.ini

In your web root create a file with the filename you found above, (e.g. .user.ini). If it's already there open it with a text editor.

In it add the line

always_populate_raw_post_data = -1

2. If not

Open your .htaccess file with a text editor.

Add the following code

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

You can read this and this

  • No need to add .htaccess, I just add always_populate_raw_post_data = -1 bottom of php.ini & restart my apache that working – matinict Feb 1 '16 at 5:06
  • As I wrote, I did this.... – Sadjad Johansson Mar 13 '18 at 23:06
2

PHP 5.6.0 and above does not support always_populate_raw_post_data, so it need to be set to -1.

This is the common error faced during Magento 2.0 installation.

Setp 1: Find out the PHP version and Server API
Create a file phpinfo.php file and paste in there the following code.

<?php phpinfo(); ?>

Go to your browser and access the above created file, this should display the infomation about php used.

PHP can run in one of two ways-
1->within Apache as an Apache module (mod_php) or
2->as a separate executable along with Apache through Common Gateway Interface (CGI, FastCGI).

In order to identify the server API(i.e CGI or Apache Module), Look for the Value under Server API Column.

for CGI based, Follow the instructions below.

Look for the file name under the "Additional .ini files parsed" as highlighted in the picture below. enter image description here

Create a file with the same name(in my case it is alt_php.ini) under your root folder(i.e Public_Html) and add the following code.

always_populate_raw_post_data = -1

Just save the file and you are done. It should work

For Apche Module based,
Add the following code to your .htaccess file

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

Sometimes it works after replacing php_flag by php_value:

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

http://piwik262.rssing.com/chan-56203786/latest.php#item5

(that was in my case)

1

I got this when installing magento. For me, nothing worked. I tried setting the always_populate_raw_post_data in (correct) php.ini, and even inside .htaccess. Finally, I was able to install magento through the command-line-interface. I had run the following command (change the values to match your environment):

magento setup:install --base-url="http://localhost/shop/"  --db-host="localhost" --db-name="shop" --db-user="root" --db-password="" --admin-firstname="Magento" --admin-lastname="Admin" --admin-email="thcdesigning@gmail.com" --admin-user="gogol" --admin-password="gogol123" --language="en_US" --currency="INR" --timezone="Asia/Kolkata" --use-rewrites="1"

To find out more about setting-up through cli, read this.

0

You need to open php.ini as an administrator, after that to change all you need in the file and after that restart the server.

0

First of all find the path of php.ini configuration file. You can find php.ini file path by using phpinfo(). Once you find the path of file. Go to that path and open the file and find always_populate_raw_post_data and set always_populate_raw_post_data = -1 save and restart the server.

if the issue still not gone you can add the always_populate_raw_post_data = -1 in your .htaccess file which is located at the root directory of Magento then restart the server.

Now this will work.

0

Create file: .user.ini Add this line in file: always_populate_raw_post_data = -1

restart setting Magento

Wooala!

Only this was help me to prevent installing error.

0

I solved this problem. I have php 5.6. Under root i have directory apache2 which contain php.ini and directory cli with php.ini. All changes earned only apache2/php.ini and this resolve my problem.

0

I found a solution for Magento!

Open user.ini from the root folder and add below line at bottom of the file.

always_populate_raw_post_data = -1 

Problem solved, Enjoy!

  • 1
    Read the post and you see what I wrote? – Sadjad Johansson May 28 '17 at 18:27
0

I use MAMP the php config is overwritten and you need to edit the template to have the always_populate_raw_post_data = -1

File->Edit Template -> PHP -> PHP XX

-1

It works, you just have to add the one line in .user.ini file :

memory_limit = 768M
max_execution_time = 18000
session.auto_start = off
suhosin.session.cryptua = off

memory_limit = 768M
max_execution_time = 18000
session.auto_start = off
suhosin.session.cryptua = off
always_populate_raw_post_data = -1

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.