Composer & Cygwin

后端 未结 13 2175
醉酒成梦
醉酒成梦 2021-01-30 04:22

Composer doesn\'t run correctly in Cygwin if you try to install it \"globally\".

Putting composer.phar into /usr/local/bin/composer, then trying to run it will result in

13条回答
  •  离开以前
    2021-01-30 04:53

    I solved the problem like this in a Cygwin/XAMPP setup:

    • Install composer.phar to XAMPP's php directory

    • Create an executable Bash script named composer in XAMPP's php directory:

      #!/bin/bash
      script_dir=$(cygpath -w $(dirname $0))
      php "$script_dir/composer.phar" $@
      

      It's important to use cygpath -w to convert the path to a path in Windows form.

    • Make sure XAMPP's php directory is accessible in Cygwin's $PATH:

      $ export PATH=$PATH:/cygdrive/i/dev/server/xampp/php
      


    Now it's possible to call composer from anywhere you like without problems:

        $ composer -V
        Composer version 264f433ca3f007d39568b3722b4bf418f58ba15b
    

提交回复
热议问题