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? Jun 5, 2018 at 10:09
  • Not working but thanks for the efforts Jun 5, 2018 at 10:33
  • Execute sudo service apache2 restart this or not? Jun 5, 2018 at 10:41

1 Answer 1


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

  • happens to me periodically at magento upgrade as it wipes my local settings
    – iphigenie
    Oct 12, 2021 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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