Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AlokDev's avatar

How to run laravel project on localhost ?

Hello,

I am trying to run my the Laravel project on localhost without using the PHP artisan serve command. But I did not get that where I have to change the path.

I have got 404 errors while route change.

0 likes
8 replies
kingmaker_bgp's avatar

I hope you were using some PHP Local Server Programs like WAMP or XAMPP.

What you have to do is, make sure the Document Root of the server / website (localhost) to be the public directory of the Laravel Application

If the Index / route works and others don't, The Web Server is not accepting / processing the .htaccess file within the public directory. And you have to Configure the Web Server to accept Overrides within the File Path too...

1 like
Tray2's avatar

If you are running Linux I recommend this guide to set up a proper lemp stack.

https://www.howtoforge.com/tutorial/ubuntu-laravel-php-nginx/

Of course you should use at least php 7.4.

Or use docker

https://www.howtoforge.com/dockerizing-laravel-with-nginx-mysql-and-docker-compose/

You can of corse use Homestead, Valet and Sail as well.

https://laravel.com/docs/8.x/sail

https://laravel.com/docs/8.x/homestead

https://laravel.com/docs/8.x/valet (Mac)

1 like
phpMick's avatar

If you want the easiest way, I would suggest Homestead.

1 like
AlokDev's avatar

Thanks, everyone for your help. I have solved the issue of installing xampp server in my ubuntu system.

1 like
Tray2's avatar

That is in my opinoin a really bad practice.

AlokDev's avatar

I am just checking out that my project is working fine in xammp environment without any changes.

martinbean's avatar

Using a Linux distribution like Ubuntu and then deciding you’re going to use XAMPP to serve your PHP projects is like buying a Hummer to do the school run in.

Please or to participate in this conversation.