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 4

  1. Change your Baseurl and Baseurl secure to instead of localhost

    run cache:flush

  2. 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:


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



<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item> 


<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.

  • Try using docker instead of wamp May 20, 2019 at 23:03

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,


If php version 7.0 then,


If php version 7.2 then,


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!

Your Answer

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

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