how to enable APP_URL in windows ? hello friends, i see in many videos that the laravel application url is set to
http://example.test
, i try to access this url but it is not available.
and it is defined in my
.env
here is the .env file:
APP_NAME=example
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://example.test
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=example
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected] "
MAIL_FROM_NAME="${APP_NAME}"
That's only an example. You have to change the APP_URL value in the .env file according to your environment.
In development, I never changed it because I'm using the PHP dev server.
In production, you should change the value and set it to the domain name of your website.
Are you using Laragon ?
@vincent15000 thanks for your replay, but i mean for development not for production, and that
example
is just an example that i set, in my real project it is another thing.
@shadkamel You should use Laragon, it's a great environment and you have all you need to develop with Laravel.
And no domain name problem ;).
https://laragon.org/
@vincent15000 thank you a lot, but why in Mac OS it is working by default ?
@shadkamel actually you can keep this line by default in .env
APP_URL=http://localhost
but you need change hosts file, the path in Windows is
C:\Windows\System32\drivers\etc\hosts
in the hosts file add (require Admin)
127.0.0.1 your-project.test
@newbie360 why in mac OS it is working by default ?
@shadkamel i don't know about Mac OS, but in Windows / Linux, we need add it in the hosts file, otherwise the OS will find the domain via DNS
tell me the name which server you use xammp or laragon
@Shivamyadav the server that installs with laravel
php artisan serve
@shadkamel
With php artisan serve, you access to the website with the following address : http://localhost:8000 .
If you develop with Laravel on Windows, you should try Laragon.
@vincent15000 i just tested now it worked thank you a lot again 💙
@shadkamel if there is a web server already running, you shouldn't run php artisan serve
Please sign in or create an account to participate in this conversation.