Install Composer on Windows with XAMPP

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.

php ini

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.

download composer

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.composer-first-step

3) Select php.exe file, click the Next button.

composer-second-step

4) No need to add proxy URL, click the Next button to continue.

composer-third-step

5) Composer setup is ready to install and click the Install button to continue.

composer-fourth-step

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.

open command

Then type “composer” and press enter in the terminal you will get following response like in the below image.

composer-terminal

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.

33 Comments
  1. Rg-050 says

    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.

  2. Alen says

    COOL! I got my installation working. Thanks!

  3. Pablo says

    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

    1. Full Stack developer says

      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

  4. Alexander says

    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.

    1. Full Stack developer says

      I’m glad it helped you. Happy coding.

  5. Edwin Adeola Oluwasina says

    This post is so straightforward and useful. Thanks to those that compiled this post.

  6. Awii says

    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.

    1. Full Stack developer says

      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.

  7. Adoga Sunday says

    you are a good teacher it is perfect. thanks so much.

    1. Vikas Kumar says

      @Adoga Sunday
      I am so glad! Thank you so much for your kind words and your support.

  8. Potman says

    So much information around – and regrettably, maybe unwittingly and unintentionally, misinformation, but this worked like a dream. Many thanks!.

    1. Vikas Kumar says

      Thanks, I’m glad it helped you!

  9. RR says

    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.

    1. Vikas Kumar says

      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.

      1. AbHiShEk ChAnDeL says

        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

  10. Siva says

    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

    1. Vikas Kumar says

      Got the same error, and fixed it with updating composer version.

      Try to do a
      composer self-update
      and then a
      composer clear-cache

  11. yawar says

    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

    1. Vikas Kumar says

      Happy coding.

  12. Sergio Simone Vidaich says

    Thanks.

  13. Jaber Jaber says

    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!

  14. Nur Fazlin Fatihah Badrul Hisham says

    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!

    1. Guillermo Kop says

      II get the same error, Have you found any solution?
      Thx in advance

      1. Berend Otten says

        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

  15. Marcelo says

    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?

  16. Buddy says

    Shared! This is AWESOME stuff! Thank you!

  17. susana says

    Thank you!! 🙂

  18. Marky says

    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.

  19. Kosronoh says

    Keep up the good work.I followed the steps to the later and for sure it worked out perfectly.
    Thanks so much.

  20. Knud says

    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) 🙁

  21. Arshad Ali says

    that is really helpful thanks dear God bless you

  22. […] 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 […]

Leave A Reply

Your email address will not be published.