0

I am using WSL2 with ubuntu 20.04 with php 7.4.3 installed on it. Sometimes, php -S (for example php -S localhost:9000 -t public) doesnt work, nor does php artisan serve.

EDIT: When trying to access the address localhost:9000 from the browser, i get: "localhost refused to connect" terminating WSL distro has never solved the issue. From the terminal i get the normal: PHP 7.4.3 Development Server (http://127.0.0.1:9000) started

Jess_Pinkman
  • 141
  • 5
  • 1
    Start by explaining what you mean by "doesnt work". Also please share any errors you're getting. – Ro Achterberg Nov 17 '20 at 12:26
  • as per the title: i get the message localhost refused to connect ("ERR_CONNECTION_REFUSED") in the browser when trying to access locaIhost:9000. have no idea how to process to give better insight into this issue – Jess_Pinkman Nov 17 '20 at 12:40

1 Answers1

2

Answering my own question.

This seems to be a common issue on WSL2, and a fix is coming. In the meantime,

  • wsl --shutdown may solve the issue.

  • if that is indeed the case, you can get the correct localhost address by using the command below.

ip addr | grep -E "\binet.global" | sed -E "s/inet(.)/./\1/“

Jess_Pinkman
  • 141
  • 5