3

I'm having a problem with Composer. I have Composer installed globally on my machine. I am trying to install intercom using composer. I tried the command:

php composer.phar require intercom/intercom-php

but that returned "Could not open input file: composer.phar"

After investigating and reading the issues others have had I then tried

php composer require intercom/intercom-php

but that returned "Could not open input file: composer"

As I stated, I have Composer installed globally on my machine. I can type in the command "composer update" and it works from any directory.

1 Answer 1

7

If you got composer installed globally and composer update just works then get rid of php and instead of

php composer require intercom/intercom-php

just do

composer require intercom/intercom-php

The reason why former form does not work while the latter does is that you are invoking php executable and pass composer as its argument. It is then treated by php binary as script file path and as there's neither relative nor absolute path segments used, just file name, then file composer is expected to exist in current working directory which is no the case. In second invocation, your shell will look for composer binary in all known paths defined in $PATH env variable.

If you wonder where composer executable realy lives, you can use

which composer

Or on Windows

where composer 
Sign up to request clarification or add additional context in comments.

1 Comment

Works perfectly. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.