Artisan Error: Failed to listen on localhost:8000

后端 未结 11 783
清酒与你
清酒与你 2021-01-30 08:58

I\'m having problem starting my laravel installation. Whenever I type in the terminal \'php artisan serve\' it responses me an error:

Fai

相关标签:
11条回答
  • 2021-01-30 09:09

    List process using ps -ef | grep php

    Then below only works for me

    kill -9 9347
    

    which is a force kill of the process

    501  9347   393   0  1:29PM ttys000    0:00.21 php artisan serve
    

    Option 2:

    If above not works, Change the default laravel serve port number if you can, like

    php artisan serve --port=8088
    
    0 讨论(0)
  • 2021-01-30 09:10

    The solution I found a problem we face several times in Ubuntu.

    *Failed to listen on 127.0.0.1:8000 (reason: Address already in use)*
    

    What we do, we change the port, right?

    This problem can be solved also in few seconds following below steps.
    1. Open Terminal
    2. **sudo su**
    3. **netstat -plnt**
    _find the process running on port 8080_
    4. **kill -9 PROCESSNUMBER**
    

    For more details, see my blog, click here

    0 讨论(0)
  • 2021-01-30 09:15

    best way if you 8000 port is busy or you have more one project running is run your project in new port such as 8088 or another free port.

    php artisan serve --port=8088
    
    0 讨论(0)
  • 2021-01-30 09:19

    When php artisan serve command given, below mentioned problem occured.

    macridmi1109@Ridmis-MacBook-Pro kcnk % php artisan serve

    Laravel development server started on http://localhost:8000/

    [Thu Aug 6 11:31:10 2020] Failed to listen on localhost:8000 (reason: Address already in use)

    Then try this line of code,

    macridmi1109@Ridmis-MacBook-Pro project_laravel % ps -ef | grep php

    Result will be,

    501 66167 1 0 11:24am ttys002 0:00.77 /usr/bin/php -S localhost:8000 /Users/macridmi1109/Documents/Laravel/project_laravel/server.php

    501 66268 64261 0 11:31am ttys002 0:00.00 grep php

    Finally run the below code and, then again php artisan serve

    macridmi1109@Ridmis-MacBook-Pro project_laravel % kill 66167

    SOLUTION EXPLAINED BELOW

    I use the command, ps -ef | grep php. After that, you will be able to find Process ID. After recognising the correct Process ID, use this command kill 66167 (kill "Process ID"). Then try php artisan serve. This worked for me.

    Happy Coding

    0 讨论(0)
  • 2021-01-30 09:20

    It is because something already running on that port and you can change the port by command itself, by running following command

    php artisan serve --port 8001
    
    0 讨论(0)
  • 2021-01-30 09:21

    Are there any other services running on port 8000?

    You can use this command on Windows:

    netstat -aon | more
    

    or on Linux / OSX

    sudo netstat -plnt
    

    to see what services are running. Then disable the service that is running on port 8000 or use another port.

    0 讨论(0)
提交回复
热议问题