I'm developing a Laravel API based on larapi project and I think I'm doing something wrong, because every request to my API takes about 3 seconds to return, don't matter the size of the response.
I've searched a lot and already tried to run the following commands, but my requests still slow:
composer dump-autoload -o
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
My server and database server are hosted separatedly. I already did some tests with other projects and the servers runs fast. It seems to be a problem with Passport (Laravel OAuth authentication), it try to authenticate the user's access token on every request.
Has anyone faced this problem?
Thanks for your attenion.
Regards.
Related
I have a website that uses vuejs as frontend and Laravel API in backend. Recently I updated my Laravel site it was working absolutely fine in my localhost. But the problem is when I upload my Laravel files to my hostinger.com hosting account it's not updating. It's displaying me old site but my database got updated and I was able to errors of the new site.
I tried these none of them seems to be working,
Cleared browser history and cache
Tried reuploading site again
I ran following commands
php artisan config:cache
php artisan route:cache
php artisan view:cache
npm run prod
Tried to use cmd command ipconfig/flushdns
Still, I was not able to solve the issue.
Have you tried refreshing your website with CTRL+F5 or CTRL+R ?
I am a PHP developer using Laravel framework and currently i have an application which is in production. The users are being forced to log in every time even if they just logged in in less than 2 mins and get the message The Page expired due to inactivity. This is causing me headache as the application is doing just fine in the development environment in my my local machine.
I have search for solutions but non is working for me including generating keys using php artisan command, clear cache,config,route and view, i have also tried to increase the number of minuted for the session to expire to up to 8 hours but the same issue still occurring.
I am actually stranded and don't know what to do else,please i need a help to get out of this.
Thanks in advance
Option 1:
Set session lifetime in .env file to SESSION_LIFETIME=120 (2 hours)
Option 2:
Try all of them.
composer dump-autoload
php artisan optimize
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
Option 3: if these have no effect add remember me checkbox on login form who save session token for long time
Hello I have a login form that returns a 419-page expired error every time I submit it I already set the #csrf inside the form but nothing and also tried the csrf_filed inside the form and also but it in the header inside of meta tag but still not working, am working on a live server so I downloaded the files on my localhost and tried to submit the form again and everything worked fine on my localhost but on the server it still returns the error 419 pages expired, and also tried to submit the request to a function that just returns hello world but it also returns page expired i have nothing on my head I tried everything I know and nothing worked please I need help with this.
And thanks a lot
Sometimes cache cause this problem. Try below commands.
These will clear all cache and generate new token for your project.
php artisan key:generate
php artisan config:cache
php artisan cache:clear
php artisan view:clear
php artisan route:clear
The fact is that I am connecting to sockets from another domain and have been trying for a long time to find out why I get 419 error when connecting to a private channel. It turns out that the csrf token is cached and I can successfully connect when the routes are not cached.
I don't know of a way to be selective about it but try running:
php artisan route:cache
php artisan cache:clear
Or for the whole set of cache clears you can run php artisan optimize
The other option would be to wait out the cache expiry but I doubt you would want to do that!
My Website is working fine on hosting server, but when I downloaded all files and want to make changes on local server is showing error on submitting the form. All form has CSRF Token
The page has expired due to inactivity. Please refresh and try again.
I have cleared cache, route, and even generate a new key by the following command.
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
php artisan generate:key
Run composer update
If still not work navigate to bootstrap - > caches and delete files present in it.
To test if token is passing use network tab in inspect element of browser.