I have Magento 2.2.4.

I have tried increasing max_input_vars in php.ini file.

I have cleared var/cache, browser cache, removed domain cookies.

Still, get the error when trying to edit an existing product. But, I can create new products without any issue.

Error: Invalid Form Key. Please refresh the page.

  • Working or not? – Dhaduk Mitesh Jun 5 '18 at 10:09
  • Not working but thanks for the efforts – Dipak Solanki Jun 5 '18 at 10:33
  • Execute sudo service apache2 restart this or not? – Dhaduk Mitesh Jun 5 '18 at 10:41

This problem is occurred after adding more custom options in the product because php.ini file not allowed to add more custom option.

So, required to change default settings of php.ini file.

Now, Edit your php.ini file.

If php version 7.1 then,


If php version 7.0 then,


Uncomment this value and update this all value in php.ini,

max_input_vars = 200000
max_input_time = 600
max_execution_time = 3600

Now Restart Apache 2 web server, and check it.

sudo service apache2 restart

| improve this answer | |

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.