There are few easy step Install Composer on Windows with XAMPP.
Install Xampp
First of all, you need to download and Install XAMPP on Windows. For more details, see our step by step guide on How To Install XAMPP On Windows and then we need to install Composer.
Composer
Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries according your project requirement and it will manage (install/update) them in your project for you.
Install Composer
Before start installation, Open php.ini file, you can find this file in the C:\xampp\php path.
Note: If you installed latest version of XAMPP (7.2.1 or more) then you don’t need to update in php.ini file , skip this step and you can continue to step first – Download Composer.
Make sure these lines are enable by removing the semicolon (;) from the start.
extension=php_openssl.dll extension=php_curl.dll
Restart your xampp, extension should be enabled after that. Now we are ready to install Composer set up.
1) First go to Download Composer page and click the Composer-Setup.exe link to download Composer for Windows Installer.
2) After finished downloading, double-click the Composer-Setup.exe file – it will install the latest composer version whenever it is executed. Click the Next button.
3) Select php.exe file, click the Next button.
4) No need to add proxy URL, click the Next button to continue.
5) Composer setup is ready to install and click the Install button to continue.
6) Once you successfully installed the Composer.
Open the command prompt. To open it, press “Win + R” keys on the keyboard, type in “cmd” and press the “OK“ button.
Then type “composer” and press enter in the terminal you will get following response like in the below image.
That’s it! I hope this article helped you learn to how to Install Composer On Windows With XAMPP.
Please feel free to comment below, your suggestion and problems if you face – we are here to solve your problems.
Who can do a lesson on installing Sitemap via Composer for a site on XAMPP? I can not find anything on the Internet on this topic. I tried to establish this sitemap https://github.com/samdark/sitemap but I could not, I did not have enough knowledge.
COOL! I got my installation working. Thanks!
Hi, I have installed XAMPP version 7.2.1 and I can find the extension=php_openssl.dll, but I cannot find the extension=php_curl.dll in php.ini. Any ideas? Thanks
Hello Pablo,
I think you don’t need you enable curl with XAMPP version 7.2.1 because in xampp/php/php.ini there is already enabled extension=curl, please continue install composer set up and please let me know if you still face any issue.
Thanks
This was very helpful. Thanks. However, it did not work when I removed the semicolon from “extension=php_openssl.dll” in the php.ini file. The installation of Composer failed. When I added it again, it worked.
I’m glad it helped you. Happy coding.
This post is so straightforward and useful. Thanks to those that compiled this post.
I followed all the steps you have mentioned, But still I am getting ‘composer is not recognised as an internal or external command’ ,I restarted my computer , checked environment variable PATH its showing correct, but still not working, can you please let me know if I am missing something and how to resolve this problem.
Hello Awii ,
Add
C:\xampp\php
to your PATH Environment Variable.Then Close your Command Prompt And Restart Again.
It’s very important because if you didn’t restart you command prompt then changes will not be reflected.
OR
Try to to restart your computer and then both composer and php will work globally.
Please check and let me know.
you are a good teacher it is perfect. thanks so much.
@Adoga Sunday
I am so glad! Thank you so much for your kind words and your support.
So much information around – and regrettably, maybe unwittingly and unintentionally, misinformation, but this worked like a dream. Many thanks!.
Thanks, I’m glad it helped you!
I got this error when I install composer:
The Composer installer script was not successful [exit code 1].
Script Output:
The “https://getcomposer.org/versions” file could not be downloaded: php_network_getaddresses: getaddrinfo failed: No such host is known.
failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known.
Hello,
Solution 1. Ensure you have net connectivity.
Solution 2. PHP required a system restart to pick it up. So unsetting the environment variables and restarting allowed the Composer installer to retrieve the required files.
Hi Vikas
i dont have internet connectivity in my desktop . i have copied the composer.exe to my folder.
Is dere any way to install composer without internet connectivity.
plz guide
Hi, I have tried to install composer but I am getting this error
The Composer installer script was not successful [exit code 1].
Script Output:
The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly
Got the same error, and fixed it with updating composer version.
Try to do a
composer self-update
and then a
composer clear-cache
yes, very thanks.
At the beginning of my installation, I encountered the following erorr:
—-
The PHP exe file you specified did not run correctly [exit code 1]:
C:\xampp\php\php.exe
—
Because I’ve changed the ‘php.ini’ file many times
Then I downloaded a default ‘php.ini’ file and changed it to the compiler
And finally I could install Composer
Happy coding.
Thanks.
No need to add extension=php_curl.dll in php.ini since curl module is already installed on XAMPP for Windows 7.3.9.
If you do so, Composer installer will raise an error and cannot advance in the setup.
I just removed it from php.ini and setup completed successfully!
Hello,
I got this error when installing the composer:
The Composer installer script was not successful [exit code 1].
Script Output:
The “https://getcomposer.org/versions” file could not be downloaded: SSL: An existing connection was forcibly closed by the remote host.
send of 24 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
send of 23 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
send of 72 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
send of 2 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
failed to open stream: HTTP request failed!
II get the same error, Have you found any solution?
Thx in advance
Got the same error… Then found the description to install composer manually and that worked for me.
http://getcomposer.org/doc/00-intro.md
Quick steps:
1. Download composer.phar
2. Create batch file to start composer. Content of composer.bat file:
@php “%dp0composer.phar” %*
3. Make sure the folder where the batch file and phar file are stored is added to the Windows environment setting “path”.
4. Test by executing:
composer -V
I am getting this error:
The Composer installer script was not successful [exit code 1].
Script Output:
Signature mismatch, could not verify the phar file integrity
Do you know how to fix this error, please?
Shared! This is AWESOME stuff! Thank you!
Thank you!! 🙂
Hello i got this problem. The PHP exe file you specified did not run correctly:
C:\xampp\php\php.exe
The program failed to run correctly. Try reinstalling the program to fix this problem. Make sure you have installed the appropriate Visual C++ Redistributable.
Keep up the good work.I followed the steps to the later and for sure it worked out perfectly.
Thanks so much.
Latest Xampp (PHP 8) and latest composer (Version 2.X) I have a try with your tutorial.
Getting the following error:
The PHP exe file you specified did not run correctly:
C:\xampp\php\php.exe
Program Output:
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) 🙁
that is really helpful thanks dear God bless you
[…] Laravel 8.x. Level Up Your Coding. The items you’ll require are listed below. In Visual Studio, XAMPP Composer is the name of the program (or code editor you’re using). Creating a database can be accomplished […]