Skip to content
Permalink
Branch: master
Find file Copy path
1 contributor

Users who have contributed to this file

83 lines (50 sloc) 3.14 KB

Composer Setup on Windows

These instructions are for Window's users; for Mac instructions on setting up Composer, go here...

Summary:

  1. PHP from command line check
  2. Installing Composer
  3. Common problems (and solutions)

PHP from command line check

In addition to running PHP on a server, you can also run PHP from command line. Composer uses PHP via the command line, so we want to first get on the same page with which installation of PHP our command line is using. Doing this will ensure we understand what version of PHP is being used and what modules we have available.

For Windows, we want PHP from command line to use XAMPP's installation of PHP, located at c:\xampp\php\

This is accomplished by adding the c:\xampp\php\ path to your computer’s PATH variable.

For complete instructions on what the PATH variable is and how to edit it, read: PATH Variables.

Once you've completed the above linked instructions, you should confirm that...

  1. You can run php from the command line.
  2. The command php is using the PHP executable that comes installed with MAMP/XAMPP.

Windows expectations

$ where.exe php
C:\xampp\php\php.exe
$ php -v
PHP 7.2.x (cli) 
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
$ php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File:         C:\xampp\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

Installing Composer on Windows

Now that your command line PHP is configured, we can move on to installing Composer.

There's an installer for Composer on Windows, which you can download here: https://getcomposer.org/Composer-Setup.exe.

Running through the installer, you should see the following screens.

Make sure the php.exe path on the second screen matches the same XAMPP php.exe you set up in your PATH.

Enlarge... Composer installation on Windows

When the installer is complete, close and restart Cmder. If you do not restart Cmder, it will not recognize that Composer has been installed.

When Cmder re-opens, you should be able to run the composer command from within any directory. This works because the installer updated your PATH variable for you, making composer available.

That's it! Composer is installed and ready to go.

Common problems

Issue: openssl

Symptoms: You get a message saying openssl is not enabled.

Solution: Identify what php.ini file you're using with this command:

$ php --ini

Open the indicated php.ini file and make sure the following line is not commented out (i.e. it does not have a semi-colon in front of it):

extension=php_openssl.dll
You can’t perform that action at this time.