Artisan Error: Failed to listen on localhost:8000

后端 未结 11 784
清酒与你
清酒与你 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:25

    for me php -S localhost:8080 from the terminal in vs code will sometimes crash, but still be running in the background.

    -9 to force kill did it for me thanks @hemss

    I did

    php -S localhost:8080
    
    [Wed Dec 12 13:48:03 2018] Failed to listen on localhost:8080(reason: Address already in use)
    

    then I..

    sudo netstat -plnt
    

    find the process running on port 8080

    tcp        2      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      10312/php
    

    then force kill it..

    kill -9 10312
    

    I get

    [1]  + 10312 killed     php -S localhost:8080
    

    then restart...

    php -S localhost:8080
    
    0 讨论(0)
  • 2021-01-30 09:28

    Use killall -9 php and if you want to close other services use killall -9 node or killall -9 mysql

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

    Fixing Error: Failed to listen on localhost:8000 (reason: Address already in use)

    List processes with php in it

    ps -ef | grep php

    Example output

    501  **9347**     393    0  1:29PM ttys000    0:00.21 php artisan serve
    501    9351    **9347**  0  1:29PM ttys000    0:02.01 /usr/local/php5-5.6.14-20151002-085853/bin/php -S localhost:8000 .../laravel/server.php
    501    9781       393    0  1:56PM ttys000    0:00.00 grep php
    

    Then kill the process

    kill -9 9347

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

    8000 is the default port. Use instead of :

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

    If you have all your configurations ok in the .env file then you should:

    Use the answer from mayorsanmayor in this post to kill all php processes. Then php artisan config:clear

    Finally, php artisan serve

    Good luck!

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