Installing PHP on Windows 10

Connect on Social

I recently had to install the PHP executable on my laptop for my local Laravel dev. I had some issues, pulled out some hair so I wanted to post what happened when I tried installing PHP on Windows 10.

Just installed the local php.exe for Windows 10 on my laptop, had some issues and thought I would log for them for others and myself. I always seem to forget these things.

First thing, get yourself the PHP for Windows files, http://windows.php.net/. Get the version depending on whether you have 32bit or 64bit system. That said if you’re on Windows 10, you should not need to answer that; it should be 64bit.

The next question you will need to answer is TS or NTS, Thread Safe or Not Thread Safe. TS is primarily for PHP modules or Webserver like IIS. This install is for PHP CLI for Laravel development so go for the NTS version.

windows-installing-php-folder-contents

You can place the files anywhere you like, but I find it simpler to have it as close to the root as possible, c:\php. Create a PHP folder where ever you like and unzip your files there. The contents of c:\php should look like this.

Now it’s time to get your php.ini file configured for your environment. The first item is to update the extension_dir directive. This will need to point to your extension DLL’s folder. Mine is “C:\php\ext”. Now activate required extensions, here is a list of items I have activated.

To enable an extension, just remove the leading; from the start of the line.

windows-installing-php-path-update

Everything should be working at this point but to make things simple and allow you to use PHP instead of c:\php\php.exe when referencing you need to update your path files. On Windows 8 or 10 you can right-click the Start icon, select System from the list then click Advanced system settings (1). Now open the environment variables (2) and from here you can update your path. You should only need to update path (3) user variable, but I update in system variables as well (4), as I am the only user on my machine.

Now you should be able to open Powershell or CMD and enter php -v will return the PHP version info similar to this.

Mine did not go this well, and when trying this command in Powershell, nothing would return. If this happens, you can get some more info on trying in the older cmd.exe. Hit your Windows Key, type cmd and press enter. You will now have cmd running, and you can try php -v On my laptop, would get the following error.

Found installing Visual C++ Redistributable for Visual Studio 2012 Update 4, both the 32 and 64bit version did the trick. Now running php -v returned the version info and everything was Happy Happy, Joy Joy.

Hope this info has helped.

The short URL of the present article is: https://wp.me/p7fZqS-3t

About Robert Wilde

Technology has been in my blood for as long as I can remember. Started with Dick Smith kits when I was 10, I was making FM wireless bugs in high school. After several years working, Electronics Technician, Sound and Lighting Technical Director and then IT Sysadmin, I am going with the flow and leaving the hardware behind, mostly. I am now developing solutions for the cloud, focus on WordPress, SharePoint and Mobile devices. Learning more and more every day.


Leave a Reply

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

%d bloggers like this: