APP_URL not refreshing after a change - laravel

I'm building a Laravel 9 app using Docker.
I'm just starting, so I merely updated the APP_URL variable in the .env (from "http://localhost" to "http://mydomain.local").
After this, I ran the following commands:
php artisan cache:clear
php artisan config:clear
php artisan route:clear
composer dump-autoload
and I restarted the Docker container of the app.
Yet, when I access http://mydomain.local in my browser, the app doesn't load. It still loads properly when I user http://localhost as originally configured.
What am I missing?

This is because you probably didnt edit the vhost..
Just changing the APP_URL in the .env file doesnt change how the browser resolves a domain name.
See this thread to learn how to edit a vhost file: WAMP Server virtual hosts configuration

Related

Laravel Password reset link is pointing to old APP_URL

I have a Laravel 8 project which is using Laravel/UI for auth.
I changed the APP_URL in the .env file from the test domain extension to IP Address. But the password reset email is showing a link with the previous APP_URL as the base URL.
The following are steps that I have tried to solve this:
Change APP_URL in .env file
Change URL in config/app.php to the IP address instead of env variable.
Ran php artisan config:clear
Ran php artisan cache:clear
Ran php artisan optimize:clear
How can I solve this?
Try running these commands:
php artisan config:cache
php artisan queue:restart
The issue was with url from where I was submitting the form. Laravel/UI reset password uses route() method to get the url for the password reset. Hence why the change in APP_URL and url variable didn't affect the link. A detailed explanation is available here

Laravel: local running the application with ASSET_URL set to local port loads forever

I am new with Laravel.
The app runs perfectly fine in the production but when running it locally it takes lot of time to load even for a simple login page (something around 15min).
I tried running it with command:
php artisan serve
and:
php -S 127.0.0.1:8000 -t public/
Tried removing:
APP_DEBUG=true
But nothing helped. Also tried:
php artisan view:clear
php artisan route:cache
But I get an error as lot of routes use closure and changing them is lot of effort.
It loads rapidly when I remove or change url in .env for ASSET_URL.

127.0.0.1:8000 keeps on loading in a laravel project

I have a laravel project but when I use the command "php artisan serve" and type the url: http://127.0.0.1:8000/ , its just keep on loading without output nor error appear.
I solved this by running this command instead of PHP artisan serve.
php -S 127.0.0.1:8000 -t public/
Then try to load again 127.0.0.1:8000 in your browser.
Try disabling your anti-virus or check your firewall.
I disabled my Avast anti-virus and it's working fine for me now.
The port 8000 might be used by other in your computer. Try to change port by running in your project in cmd:
php artisan serve --port=1000
then type http://127.0.0.1:1000/ on your browser.
Run commands
php artisan config:clear
php artisan config:cache
Even after completing these steps, if Laravel is still showing error, check your_project/storage/logs/laravel.log.
Try these three commands for clearing cache config:
php artisan config:cache // clear config cache
php artisan config:clear // clear config cache
php artisan cache:clear // clear cache
php artisan optimize // To reoptimize the class loader
php artisan route:cache // clear route cache
php artisan view:clear // clear view cache
It sometimes happen because of too many redirection and also sometime because of middleware . so see your whole flow for that page.
Also see your cdn which included in your page because it take too many time if you have too many cdn and your connection is slow. And also try to clear all cache.
I experienced this problem also when I first launched out into Laravel.
Your port 8000 is most likely occupied by another service or program.
Simply go to your terminal where your project is open, and enter the following command
php artisan serve --port=1000
Then, return to your browser and enter the address, replacing 8000 with 1000, as in
127.0.0.1:1000
This worked for me.
There are several issues may be possible for that.
You have used CDN JS and CSS
Check you route/web.php
Check you log error log file storage/logs/laravel.log
Check above points this will sure give you positive result.
In my case I uninstalled Xampp and reinstalled it(I'm assuming you are using Xampp too).It worked for me.
If you are using xampp
just restart Apache and MySql

php artisan serve does not allow change .env file

I found the problem
if i restart php artisan serve the changed values are applied. this is
the norm? how can i solve this
I created a router where I output config information
I'm trying to change value from .env file, for example APP_NAME, from APP_NAME="Nuxt + Laravel" to APP_NAME="test" but the change is not displayed on the page!(of course I reloaded the page 😊)
I was trying to look through php artisan tinker
It works!
But my config remains the same. I can not solve this problem for a week now.
I cleared the cache!!! I tried php artisan cache:clear, php artisan config:clear (i tried all command for cache)
CACHE_DRIVER=file
I deleted files bootsprap/cache/*, storage/framework/cache/*.
I tried everything!!!
I have this project on the github: https://github.com/iliyaZelenko/laravel-nuxt.
Please help me, I want my project to be used by other people.

Laravel 5.4 Token Mismatch Exception on live server

I am facing Token mismatch exception in Laravel 5.4 on live server. On my local machine running Windows XAMPP, the application works fine. When I deployed it to live machine running CENTOS 7 and LAMP stack, I see a redirecting to myhostname.com/login at the top left corner of the browser and then lands on an error page showing:
token mismatch exception on line 68 of VerifyCsrfToken.php.
I had this same problem and what i did was:
First in your .env file remove: SESSION_DOMAIN
And in set session driver like: SESSION_DRIVER=file (if your want it to save to a file)
then do: php artisan cache:clear
then `php artisan config:clear
that worked for me.
Try to clear config cache on the server with :
artisan cache:config
You will need to clear config cache also if you edited config/app.php for some reason.
In addition there is an other possible reason : you copied not only the application but also the cache/session files when you deployed your application to production. Basically everything in the storage folder should be ignored on deployment.
Run this command
php artisan config:clear
Verify .env file
delete current .env file and create new .env file from .env.example
verify that config/session.php has is correct or not modified.
You can check the file permission as well of storage directory

Resources