How to run Laravel 4.2 built in web server


Laravel 4.2 comes with built in web server, which can be use for quick development environment, this built in web server should not be used on production though.

You can run the built in web server with php artisan command, to run the web server, you need to open your terminal/ console/ command line mode.

Once you are on the command line mode, navigate to the directory of the laravel project that you working on and finally run the artisan command:

php artisan serve

In some cases, specially for linux users, if your laravel project directory is under root directory (/), you need to run it with sudo command, like this:

sudo php artisan serve

Once the web server running, you can open your favorite web browser and then go to url http://localhost:8000.

http://localhost:8000

By default, the web server will run on port 8000, but if that port is used, you can use other port, by using --port parameter and specify the port number you wish to use.

php artisan serve --port=9999

Note that if you try to access the web server through network, it won't work, there is a solution to this problem which i will show you in the next article.



EmoticonEmoticon