Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to start laravel development server on linux

I am using laravel 5 for my project and everything has been working fine but recently I am facing this problem which I done understand.

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)

I have tried devboy@devboy-hp ~ $ sudo netstat -plnt and get

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  

Then I change port like so php artisan serve --port="8888" but get similar error like below after a while:

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)

The first time it happened, it was java using port 8000, so I killed the process and started the server and it worked. Upon stopping and restarting, I get the same error. What could be the problem (as I said everything has been working fine except now and I have not done any major update)?

like image 977
Fokwa Best Avatar asked Dec 02 '22 13:12

Fokwa Best


1 Answers

Your previous deployment in your local is already running that's why you can't run php artisan serve. You can solve your issue by following this command in your terminal:

  1. ps -ef | grep php you'll see this list:

    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

  2. Now kill it using: sudo kill 6690 if still exist then use this sudo kill -9 6690 you'll see this result:

    [1]+ Killed php artisan serve

Now you can serve your local using php artisan serve again

like image 185
Gujarat Santana Avatar answered Dec 05 '22 22:12

Gujarat Santana