DEV Community

David Long
David Long

Posted on

First time ever installing PHP and Laravel on Windows

Today I decided to take a crack at setting up a Laravel environment on my personal machine. I did a tiny bit of Laravel coding at my previous job, but I wanted to build something from scratch that I could use for a portfolio project. I found a good tutorial on YouTube, but two hours after starting I was still only 8 minutes into the video. I missed a critical step, and I kept running into issues. In the end everything was super easy to fix, but I'm documenting the setup process for future reference, and hopefully this will save someone else some grief as well.

As a disclaimer, I'm on Windows and using the latest software releases as of Jun 2019. Mileage may vary.

First thing to do is download and setup PHP. I downloaded version 7.1.30.

windows download

Next create a folder where you want PHP to live. I created mine at the root of C the drive.

windows download

After the PHP file has downloaded, extract the contents of the zip file to your new folder. And add the folder location to your PATH.

windows download

Next copy/rename the php.ini-development file to be called php.ini. It's very important that this file exists.

windows download

In the newly created file configure the extensions by searching for and un-commenting these lines of code:

extension_dir = "ext"

windows download

windows download

The first two lines of code above solve the following error when trying to install Laravel via Composer:


And by modifying the ini file to include the necessary extensions this should prevent composer from trying to modify the file during install.

Next install Composer. For me downloading the exe and installing with accepting the defaults was sufficient.

composer download

After Composer is installed run:

composer global require laravel/installer

Then you should be able to run:

laravel new myFirstProject

And hopefully you will be free from errors. If you do encounter any errors it's likely an issue with the ini file and missing extensions.

I know that this installation process is very trivial and hardly in need of a guide ( and there are probably better ways to get setup). But being new to the world of PHP the setup process was a bit foreign to me and I managed to get hung up for bit. Hope this helps someone.

Top comments (2)

ut4utc profile image

Thanks. I want started learning Laravel, but I'm Mac user. Do you have a link about nice courses about Laravel?

davdaarn profile image
David Long

I was following this tutorial on youtube. It does require some PHP knowledge but the instructor is using a Mac. The tutorial also uses Vue.js for the front-end.

This tutorial on udemy seems really good and the website is built using PHP blades for server-side rendering.