Laravel post submit not working in online server (Hostgator), but in localhost it work! In my form have csrf_token, but when i do the submit the error appeared
TokenMismatchException in VerifyCsrfToken.php line 68:
I researched and found a problem in this section
protected function tokensMatch($request)
{
$token = $this->getTokenFromRequest($request);
echo $token ."<br>". $request->session()->token();
return is_string($request->session()->token()) &&
is_string($token) &&
hash_equals($request->session()->token(), $token);
}
In Localhost print
hVTvxkMDDYNo9uQCe3lIiNxA0cmgBTIU2SBR9zUS
hVTvxkMDDYNo9uQCe3lIiNxA0cmgBTIU2SBR9zUS
In Hostgator
0fzg4Kyh7HEptHbyL3Y4Z7WGpnMACMJfIBjqxQvT
MFfASxkuUASEdBzqNb9N2LXCb0RmasGVvG043BEm
My folder "storage\framework\sessions" is 777
That is weird that it's working in local but not production. Try changing to 755. And make sure everything has proper names don't forget Linux is case sensitive. Clear any and all cache.
Please sign in or create an account to participate in this conversation.