How to Install Composer and PHP on Windows 10

How to Install Composer and PHP on Windows 10

Last updated on

In this guide we will install Composer and PHP on Windows 10 so that we can install dependencies for our web apps directly from Windows command line.

1. Download PHP and Visual C++

Go to the Windows PHP download page and download the .zip of the version of PHP you require.

In this guide, we are installing PHP 7.3 VC15 x64 Non Thread Safe, which is the latest version as of writing.

Download PHP for Windows 10

VC15 is the version of Visual C++ Redistributable for Visual Studio required to run this version of PHP. The lefthand sidebar on the Windows site will have download links to all the different versions of Visual C++. Alternatively, you can go straight to the Windows Download page and download vc_redist.x64.exe.

2. Install Visual C++

Once downloaded, run the installer.

Install Visual C++ Redistributable for Visual Studio 2015

3. Extract PHP

Create a new folder in c:\php7 and extract your PHP zip to it.

PHP7 for Windows extracted

4. Add c:\php7 as Path Environment Variable

So that you don’t have to type the whole path to php.exe every time you run a command, you should add c:\php7 as a path environment variable.

Open System Properties by clicking the start menu and typing sysdm.cpl and press Enter.

Windows 10 view advanced system settings

In System Properties, click Environment Variables.

Windows 10 System Properties

In System Variables, click Path and then click Edit.

Click New, type the path to your PHP folder (c:\php7) and click OK.

Add new path environment variable Windows 10

Close the System Properties dialogue by clicking OK.

If you have any Command Prompt windows currently open, close them now.

Open Command Prompt, type php -v and press Enter. You should now see the PHP version.

Windows 10 PHP 7 in Command Prompt

5. Install Composer

Go to the Composer Download page, and download and run Composer-Setup.exe.

In the second step of Composer Setup, make sure the correct path to php.exe is set and click Next.

Installing Composer PHP Windows 10

If Setup prompts to create php.ini, allow it and click Next.

Skip the Proxy URL settings, just click Next then click Install.

Click Finish once install is complete.

6. Test Composer

Open up Command Prompt and type composer -V.

If all was installed correctly, you should see a version number.

Composer in Windows 10 command prompt

Hurrah! You can now run Composer and PHP on Windows 10.

Let me know in the comments if this helped. Follow me on Twitter, Facebook and YouTube.

p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.

1 Star2 Stars3 Stars4 Stars5 Stars 5.00 (11 votes)

Leave a Reply

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

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces

14 replies