I am unable to save the product in magento2. it show "Invalid Form Key. Please refresh the page. in local
how to resolve this?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
This bug arises due to php.ini variable "max_input_vars" Increase it to 10000 through below php function:
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)
If you are running this Magento site on a local machine (local host) as your question seems to indicate, you may have trouble using the: http://localhost/ syntax, as Magento 2 doesn't fully know how to deal with cookie.
Instead, I'd recommend using http://127.0.0.1/ to access the local site; in this case your browser should be able to recognize this more easily and work with Magento's cookies properly.
You may need to set a cookie domain in the admin area of Magento.
I hope this helps...
Have you tried using different browser? I usually use Google Chrome but came across this problem, setting max_input_vars to higher values didn't help, neither using local IP address instead of localhost, but I tried using Firefox and it worked.
Try This Ubuntu 14.0.4 System in magento 2.3-invalid Form key error.
I face invalid Form key error on frondend-side insertion, But crome browser only occured this error, Insertion correctly run in firefox browser.
I solved this error Following steps:-
Change your base URL from localhost to 127.0.0.1.
Using localhost as the domain in your base URL causes problems in Magento 2.
Magento's base URL configuration is located in the core_config_data table. The following values may need to be changed:
After changing the url, flush the cache (bin/magento cache:flush). You might also need to clear out your var directories.
I find this solution through this Like https://magento.stackexchange.com/a/122167/78151
setting max_input_vars to 10000 in php.ini resolved my issue.