I am using php 7.2.13 version and magento 2.3 latest version in xampp. When i do add to wishlist and save anything am getting Invalid Form Key. Please refresh the page? this error.
4 Answers
Change your Baseurl and Baseurl secure to
127.0.0.1
instead oflocalhost
run
cache:flush
Or delete all directories below
var/cache
Life saver. This worked for me. It also solved my other problem of getting a blank admin panel page. I am testing a fresh install of Magento 2.1.3 on WAMP.
Other fixes I needed to make it work on WAMP:
\wamp64\www\\vendor\magento\framework\View\Element\Template\File\Validator.php
Changes at line 138:
//$realPath = $this->fileDriver->getRealPath($path);
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
- ROOT > var > cache > DELETE ALL
- ROOT > var > page_cache > DELETE ALL
- ROOT > var > session > DELETE ALL
\wamp64\www\\app\etc\di.xml
Replace:
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
With:
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>
So many answers difficult to get answers that work for you. WAMP related answers were difficult to find for 2.3.1.
Besides, it is so hard to get Magento 2.x versions to work straight away. Still struggling to make it work on Ubuntu 18.04.
This problem is occurred after adding more custom options so because php.ini file not allowed to add more custom options.
So, we need to change default settings of php.ini file.
If php version 7.1 then,
/etc/php/7.1/apache2/php.ini
If php version 7.0 then,
/etc/php/7.0/apache2/php.ini
If php version 7.2 then,
/etc/php/7.0/apache2/php.ini
Uncomment this value and update this all value in php.ini,
max_input_vars = 200000
max_input_time = 600
max_execution_time = 3600
Then Restart Apache 2 web server, and check it.
sudo service apache2 restart
If its any help for future lurkers
I had this issue happening in prod, tried every single link in Google - didn't work
What worked?
Seems that the form_key
cookie was being added the httpOnly
flag by an apache config adding that flag to all cookies
Once I removed the httpOnly
for the form_key
cookie everything worked as it should!