May Sale! All accounts are 40% off this week.

hrosenthal's avatar

WAMP localhost

I recently upgraded my WAMP server and here is what happens with Laravel.

When I run php artisan serve and enter http://127.0.0.1:8000 my project runs fine. I understand that Laravel sets up it's own server config at port 8000.

Since I use the same folder, it used to also work when I simply entered localhost/projectname into my browser.

Now when I enter localhost/projectname into my browser, I get a directory listing of the folder contents. However, localhost/projectname/server.php works.

I am assuming I need to add server.php to my httpd.conf file, but want to confirm if that's the right way to handle it. I ask this because I don't see server.php referred to in my previous WAMP httpd.conf file (I installed the WAMP update to a new folder).

thanks, Howard

0 likes
5 replies
Ty's avatar

The way I setup my projects is in a folder under my documents. I use wamp only for MySQL. You will just go to the folder of your project start up the laravel server and it should work. I have found trying to run laravel in Wamp it becomes troublesome.

hrosenthal's avatar

Correction: I do not get the same result when I enter http://127.0.0.1:8000/projectname as when I run localhost/projectname/server.php. the former works as expected, the latter gives me the original Laravel page.

Snapey's avatar

If you use wamp then DONT start php artisan serve - they are doing the same thing but on different ports

If wanting to use WAMP you need to set the document root to the public folder of your project and not the root of your project.

Then your site will be accessible at http://localhost/ and index.php will be found and loaded

Plenty of tutorials on the net, eg

https://webmasters.stackexchange.com/questions/43522/how-to-change-the-www-root-directory-on-wampserver

DavidLi's avatar

virtual host would be a better choice when using WAMP

siangboon's avatar

startup the web service using php artisan serve will have the work done behind and understand the public folder under the command path as the document root, in order to have the apache to work, you need to setup the document root accordingly as Snapey mentioned, if you have multiple host you need to setup virtual host.

Please or to participate in this conversation.