Php Artisan Serve Not Working

June, 18 2020 PHP Laravel

I will share with you how to serve your Laravel based project using another PHP command.

Basically, Laravel serves its application locally if you have PHP installed in your local machine using the below serve artisan command to start a development server at http://locahost:8000:

php artisan serve

With the use of the latest version of Laravel 5.X, the artisan serve command may not properly work well for you. This is a problem, I, personally have experienced a number of times. In most cases, your browser will keep running with a blank page at the development server which is so annoying. If you're faced with this problem, simply go to your project root directory in the command line and enter the following command:

php -S localhost:8000 -t public/

After running the command, you should have something similar to the screenshot below in your command line:

Command Prompt - php -S localhost:8000 -t public/

Command Prompt - php -S localhost:8000 -t public/


Now, head over to your browser and type the below line in your URL:

localhost:8000

You should have something similar to the screenshot below:

Laravel root page

Laravel root page

That's it! You now have your application served! Go ahead and build something nice!


Thoughts

You can share your thoughts with me in the comments section on Twitter or LinkedIn

By Ayanlola Bayo Timileyin

Full Stack Web Developer