Laravel4, Work on PHP5.4 web server
Tags : Laravel4
There are small tips.
If you used to above PHP 5.4, you can use it as development web server. And Laravel 4 support it.
Following commands and example for users Linux + bash.
On a terminal, hit this:
php artisan serve
Just it! It display next message, and your terminal don't accept your command during PHP server working.
Laravel development server started on localhost:8000...
Then, you can access localhost:8000
from your browser, you can see root page of your site. No more xmapp mamp, lamp, pamp, camp... any more. It's very easy.
So, how do you do when you want to stop web server? It depends on your environment, but normally you can use 'CTRL+C' to stop it. (Maybe on windows, CTRL+D? or CTRL+Z?? I'm not sure now... :P )
If you know Linux, of cause you can use '&' for tail of server kick command. I tried it, but it didn't work. (Maybe needed '-q' option of output redirections. But I didn't attempt them.)
Stoped it, and try to work again, then show following error message, it showed you prior command didn't stop perfectly in your linux system.
Laravel development server started on localhost:8000... [Sat Apr 6 07:49:42 2013] Failed to listen on localhost:8000 (reason: Address already in use)
OK. Check working processes.
ps -F
And you can see all your processes you started.
UID PID PPID C SZ RSS PSR STIME TTY TIME CMD hiro 5683 5679 0 2172 4052 1 07:29 pts/0 00:00:00 /bin/bash hiro 6476 5683 0 9379 6852 1 08:01 pts/0 00:00:00 php artisan hiro 6486 5683 0 1540 1188 0 08:04 pts/0 00:00:00 ps -F
On this example, 2nd line item is php web server that you kicked off by Artisan command 'server'. Check CMD column, it showd your typed head of command 'php artisan'.
So remember that PID, now it is 6476.
Next, you force to stop it.
kill -9 6476
kill -9
means 'Stop forcedly', then PID you memebered. So, now you can start web server again.
Also you can specify host name, port number and/or else. You can check them php artisan --help serve
Try it.