|

Install Laravel on Windows

Install Laravel on Windows

This is going to assume we are starting from scratch using a fresh install of WAMP 2.4 on Windows. In doing this myself, I ran into a few gotchas so this post will document those hiccups and get you running with Laravel right away. Update: We now also have a guide to Install Laravel Homestead on Windows if you prefer a Virtual Machine environment! So read on if you’d like to install right on the local machine with WAMP, or follow the link above if you’re ready for Laravel Homestead.


Install Wamp

Start by getting a nice fresh copy of wamp over at http://www.wampserver.com/en/

Install Composer

Now we can install Composer. This is great, let’s go ahead and do that by visiting http://getcomposer.org/ and download the windows installer now. Once the installer is downloaded, go ahead and doubleclick the file to begin installing composer on your Windows machine.

Install Laravel

Now you are excited, you are ready to rock with Laravel. We got Wamp. Check. We got Composer. Check. We got Game. Check.

Let’s run the command: composer create-project laravel/laravel blog --prefer-dist

in the www root directory of WAMP. I can’t wait to see this in action! Whoops, I don’t think we were supposed to see this:

Result: [RuntimeException] You must enable the openssl extension to download files via https

Ok, fair enough. Let’s go ahead and enable the PHP extension in WAMP. It’s so easy after all, all we have to do is click the WAMP Icon in the task tray, choose PHP->PHP Extensions->php_openssl! Now we can restart all services and DO THIS.

Run the command: composer create-project laravel/laravel blog --prefer-dist

Result: [RuntimeException] You must enable the openssl extension to download files via https

WHAT THE …?! Still getting errors and no install. But it said to enable open SSL, and my extension has a nice checkmark next to it in WAMP, WHAT IS THE DAMN PROBLEM?!

Turns out, if you enable open SSL through the wamp UI, it doesn’t actually turn it on. After perusing stack overflow, I find that you also have to navigate to your C:wampbinphpphp5.4.16 folder and uncomment the extension=php_openssl.dll in the php.ini file.

Ok let’s remove the ; to uncomment openssl, restart all services, and DO THIS. No this time, I really mean DO THIS!!

Run the command: composer create-project laravel/laravel blog --prefer-dist

Bingo Bango! – ok, no errors, it’s thinking, oh wow – we’re really downloading some awesome stuff now!

Blog project built. Awesome. Ok, small setbacks aside – I’m ready to really rock and roll – let’s create our first route! Per the docs at Laravel, lets add this code to our routes.php file

Now, if you hit the /users route in your web browser, you should see Users! displayed as the response. Great! You’ve just created your first route. Ok, let me try it

Hit it: http://localhost/blog/public/users

WHAT THE…?! oh yeah, we also need to enable mod_rewrite in apache. Ok, go uncomment the line LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf. Restart all services, Try again: http://localhost/blog/public/users

Awesome – I’m outputting Users!

Well, there you have it – in case you find yourself not actually going as fast as the docs make it seem you will, this guide gave you the step by step in getting Composer and Laravel installed in a Windows WAMP 2.4 environment, and we went from zero to hero, or rather zero to our first route in no time flat. Now that you are up and running go check out Crud In Laravel 4!