phpandroidlaravelconnectionlaravel-artisan

Create server locally with laravel but can not accessed


i create server locally on my PC, with laravel project and running with command php artisan serve --host 0.0.0.0 i try to access with google chrome type http://192.168.099:8000 and it can be access. but when i try to open with my android project, the ip address can not be access. whats wrong with that ?

i can connect both, with browser and with android device


Solution

  • this may work:

    Find your PC's local IP address:

    Run the following command in your command prompt or terminal:

    ipconfig (Windows) ifconfig (Mac/Linux)

    Note the IPv4 Address (e.g., 192.168.1.100).

    Serve your Laravel application:

    Start your Laravel development server with:

    php artisan serve --host 0.0.0.0 --port 8000

    Allow port 8000 through your firewall:

    Open your firewall settings and allow incoming connections on port 8000.

    Access from your Android device:

    Open the browser on your Android device and type:

    http://192.168.1.100:8000 Replace 192.168.1.100 with your actual PC’s IP address.