Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Beingsk's avatar

Failed to listen on ipaddress:8000 (reason: Cannot assign requested address)

php artisan serve --host=ipaddress --port=8080 it shows: Failed to listen on ipaddress:8080 (reason: Cannot assign requested address)

0 likes
19 replies
sr57's avatar

where do you define ipadress? What is its value?

Beingsk's avatar

IP address is my router's ipaddress. I wrote that so no need to define

sr57's avatar

OK, but you don't answer my question, ipadress is only a text in this cde, if you are on linux, it should be definie in /etc/host or in a dns server if you have one ...

Beingsk's avatar

In this code, for privacy, I have hidden it but its there

sr57's avatar

And you can telnet to ipdress 8080? or 8000 (your port in the titel dffers from the one in the post)

Snapey's avatar

it should be localhost not your router ?

Beingsk's avatar

if I used localhost I'm unable to access it on phone...how to access a laravel website on the phone?

automica's avatar

if you are on the same network you can access your local machine by using its IP on your network and its port

something like:

192.168.0.2:8080

BTW if you are mac, and using safari. You can plugin your iPhone by cable and using developer menu, access the website directly on the device.

1 like
Beingsk's avatar

But I'm unable to access using 192.168.0.12:8080 and I don't know why in android phone and hosting in ubuntu using WSL

sr57's avatar

And if your are not on the same network, that's probably the case, you have to transfer (NAT rules) on the router.

sr57's avatar

Because you phone is not on the same network 192.168.0.0-255

Beingsk's avatar

no, phone and the local machine are connected to the same network.

siangboon's avatar

you can use your local ip address, if your phone and local machine is connected to the same network, your phone should be able to connect to the private ip address of the machine, provided the firewall incoming rule allow the access...

Beingsk's avatar

I'm already connected to the same network on both phone and local machine

sr57's avatar

Are you sure*, does your router see the IP of your phone?

*At the beginning you wrote that ipadress is the router address, but that's no sense on a local network.

Snapey's avatar

How do you host the site when you are developing locally?

You host the site then find the IP address of your server on the local network, then type it into the browser address bar on your phone.

This has NOTHING to do with your router if everything is internal to your network.

Make sure any firewall on your local web server is configured to allow external devices to connect to your machine on whatever port you are using (8000 / 8080 / 80)

If you are using virtual hosts on your webserver then your mobile device will need to have its hosts file altered so that it can access the correct website on your local machine.

OR, use expose from beyondco.de https://beyondco.de/docs/expose/introduction

Please or to participate in this conversation.