Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I WORK ON LARAVEL PROJECT
when i run my app
C:\Users\ahmed.barbary\Desktop\contactppect\acellemail>php artisan serve
Laravel development server started: <http://127.0.0.1:8000>
 PHP 7.4.3 Development Server (http://127.0.0.1:8000) started


I need to change 127.0.0.1 to another ip on lan as
192.168.2.2:8000
How to do that please ?
I need to see that from another pc

What I have tried:

i change ip on env on my project and on httpd-conf
but nothing changed
APP_NAME='Acelle Mail'
APP_ENV=local
APP_DEBUG=true
APP_DEMO=false
APP_KEY=base64:phaWXLV6Yk2glr3SfJgeQ6kcyktk/DjrU+OhNxQ0iyE=
APP_URL=http://192.168.2.37
APP_LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=192.168.2.37
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=192.168.2.37
REDIS_PASSWORD=null
REDIS_PORT=6379
Posted
Updated 24-Mar-20 1:14am

1 solution

YOur LAN IP address is not normally something you control - it's allocated by the DHCP (Dynamic Host Configuration Program) which normally is part of your router or similar equipment. It may be that you can set it to assign a fixed IP address to your specific machine, but even if you can, the procedure will be different for each DCHP make and model.

But ... IP address 127.0.0.1 is a "special case" - it's the loopback address[^] which normally resolves from "localhost" to mena "this machine".

I think you need to rethink what you are doing here - another machine will not resolve 127.0.0.1 to anything other than itself, and unless 192.168.2.2 is set as a static IP in your DCHP you will probably lose that the next time the computer is rebooted. You should almost certainly be using host names, rather than IP addresses!
 
Share this answer
 
Comments
ahmed_sa 24-Mar-20 7:38am    
I ask this question because i need to access my laravel project from another machine on lan
locally laravel project work
but it not work ovrer lan
can you please tell me what i do to see my app from another pc on my lan
i use ip 192.168.2.37 and i can see that ip from anoter pc
but laravel project cannot see it
although it work locally
phil.o 24-Mar-20 8:09am    
That is something you have to configure on your web server itself: make it listen to your LAN address and not your loopback address.
Thus, the methodology depends on which web server you are using.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900