Install Laravel 5 on WAMP Server

In this super small tutorial we’ll learn how to install Laravel 5 on WAMP server. It is assumed that you have a basic knowledge of WAMP. I am using Windows 7 Operating system. In case you are using Windows 8 or 10 or even a XP, the installation steps will remain the same.

For installing Laravel we’ll require composer. For those of you who don’t know what a composer is, Composer is a dependency manager. What is means that suppose you are adding a package to your project using composer. And say the same package requires few other packages for it to work. Then you don’t have to worry about including those packages in your project. Composer will automatically add it for you. Composer works on command line. In case you haven’t installed composer yet, read the below article on how to install composer on WAMP and Windows.
http://perials.com/install-composer-on-windows-and-wamp/

Open command prompt and cd to your webroot. In most of the cases the webroot is the C:\wamp\www directory provided you haven’t changed the default settings of WAMP.

Press enter after the above command

The above commands will change you directory to www folder. Suppose you want to name your project myapp. Type the below command and press enter

This will create a directory myapp and install Laravel files into that directory. The above command will take few minutes, since composer will download all the required files in the myapp directory.

Once downloaded you can access your Laravel application on below url:
http://localhost/myapp/public

But wait a minute. This is not what we want. We want our app to be at http://localhost/myapp. The reason Laravel puts it that way is because it wants the core files to be not accessible to the end user via their browser. So usually the public folder is your public_html (or webroot) directory and all other files are out of the public_html directory. Since anything outside public_html is not accessible directly your core files are secured.

However in our case we would like to have our project root as the myapp directory and not myapp/public. So simply copy all the contents of pulic directory outside it i.e in myapp directory. Then delete the public directory as we no longer require it.
Now open the index.php file in your favorite text editor and change

to

Also change

to

What we have done here is change the path to autoload.php and app.php. This has to be done since we have moved the index.php file outside the public directory.

Now you should be able to access your Laravel application at http://localhost/myapp

Leave a Reply

Your email address will not be published. Required fields are marked *