我正在使用laravel 5进行我的项目,一切都运行正常,但最近我遇到了这个问题,我明白了.
devboy@devboy-hp ~/sonel_ims_project/ims_eneo $php artisan serve
Laravel development server started on http://localhost:8000/
[Fri Nov 13 12:00:56 2015] Failed to listen on localhost:8000 (reason: Address already in use)
我试过devboy @ devboy-hp~ $sudo netstat -plnt并得到
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1840/dnsmasq
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1985/cupsd
tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN 7563/php-5.6.3
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1656/master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 6966/httpd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 740/smbd
tcp 0 0 127.0.0.1:6942 0.0.0.0:* LISTEN 7442/java
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 6931/php-5.6.3
tcp 0 0 0.0.0.0:6667 0.0.0.0:* LISTEN 1539/ircd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 740/smbd
tcp 0 0 127.0.0.1:63342 0.0.0.0:* LISTEN 7442/java
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6966/httpd
tcp6 0 0 :::21 :::* LISTEN 7337/proftpd: (acce
tcp6 0 0 ::1:631 :::* LISTEN 1985/cupsd
tcp6 0 0 :::3128 :::* LISTEN 1416/squid3
tcp6 0 0 :::25 :::* LISTEN 1656/master
tcp6 0 0 :::445 :::* LISTEN 740/smbd
tcp6 0 0 :::3306 :::* LISTEN 7343/mysqld
tcp6 0 0 :::139 :::* LISTEN 740/smbd
然后我改变端口就像这样php artisan serve –port =“8888”
但是过了一会儿得到类似的错误:
Laravel development server started on http://localhost:8888/
[Fri Nov 13 12:01:02 2015] Failed to listen on localhost:8888 (reason: Address already in use)
它第一次发生时,是java使用端口8000,所以我杀死了进程并启动了服务器,它工作正常.停止并重新启动后,我收到同样的错误.可能是什么问题(正如我所说的一切都工作正常,除了现在我还没有做过任何重大更新)?
解决方法:
您在本地的先前部署已经在运行,这就是您无法运行php artisan服务的原因.您可以在终端中按照以下命令解决问题:
> ps -ef | grep php你会看到这个列表:
gujarat 6690 3500 0 05:55 pts/1 00:00:00 php artisan serve
gujarat 6694 6690 0 05:55 pts/1 00:00:00 sh -c ‘/usr/bin/php5’
-S localhost:8000 ‘/home/gujarat/WebDevelopment/quickstart-basic’/server.php
gujarat 6695 6694 0 05:55 pts/1 00:00:00 /usr/bin/php5 -S localhost:8000
/home/gujarat/WebDevelopment/quickstart-basic/server.php
gujarat 7436 3500 0 06:26 pts/1 00:00:00 grep –color=auto php
>现在杀死它使用:sudo kill 6690如果仍然存在然后使用这个sudo kill -9 6690你会看到这个结果:
[1]+ Killed php artisan serve
现在,您可以再次使用php artisan服务为您的本地服务