Composer Setup on Windows
These instructions are for Window's users; for Mac instructions on setting up Composer, go here...
- PHP from command line check
- Installing Composer
- 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
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...
- You can run
phpfrom the command line.
- The command
phpis using the PHP executable that comes installed with MAMP/XAMPP.
$ 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.
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
That's it! Composer is installed and ready to go.
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):