Magento – Invalid Form Key. Please refresh the page
adminformsmagento2pageproduct
I am unable to save the product in Magento 2.
It shows "Invalid Form Key. Please refresh the page. in local
how to resolve this?
Best Answer
This bug arises due to php.ini variable "max_input_vars"
Increase it to 10000 through below php function:
ini_set('max_input_vars', 10000);
OR
Using linux command line
cd /etc/php/7.0/apache2/
vi php.ini (Open for edit and set max_input_vars=10000)
:wq(Press esc and write the mentioned command to save and exit)
sudo /etc/init.d/apache2 restart(Restart Server)
There is one more source for this error: a wrong cookie_domain in the configuration. As you can't login into the admin area, you can check it directly via mysql:
SELECT * FROM core_config_data WHERE path LIKE '%cookie_domain%';
You can change the value in mysql directly as well. Don't forget to clear the cache afterwards.
Best Answer
This bug arises due to php.ini variable "max_input_vars" Increase it to 10000 through below php function:
OR Using linux command line