Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


$ composer update friendsofsymfony/elastica-bundle
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
$ php composer.phar update friendsofsymfony/elastica-bundle

The thing to remember is that if you installed it correctly (on Windows) and added it to your environment's PATH variable then you do not need to type php composer.phar and use composer instead.

Then it's likely that you, like me, ran those commands and didn't read the next part of the page telling you to stop referring to composer.phar by its full name and abbreviate it as an executable (that you just renamed with the mv command). So this:

Note
Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


composer install
php composer install

even without extension? Also, please add 4 spaces indetation to your code lines so that they are formatted as code

Note
Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


php composer.phar install

Easy answer, navigate to the directory where you already have the composer.json file that you want to run (ideally your project folder) then download composer into the same folder, then instantly run the install command like so:

This will automatically find the composer.json and run your required scripts. Good luck. This stuff is a breeze for terminal wizards and totally bizarre to the rest of us

Note
Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


php composer.phar install

Easy answer, navigate to the directory where you already have the composer.json file that you want to run (ideally your project folder) then download composer into the same folder, then instantly run the install command like so:

This will automatically find the composer.json and run your required scripts. Good luck. This stuff is a breeze for terminal wizards and totally bizarre to the rest of us

Note
Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


$ composer update friendsofsymfony/elastica-bundle
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
$ php composer.phar update friendsofsymfony/elastica-bundle

The thing to remember is that if you installed it correctly (on Windows) and added it to your environment's PATH variable then you do not need to type php composer.phar and use composer instead.

Then it's likely that you, like me, ran those commands and didn't read the next part of the page telling you to stop referring to composer.phar by its full name and abbreviate it as an executable (that you just renamed with the mv command). So this:

Note
Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


composer install
php composer install

even without extension? Also, please add 4 spaces indetation to your code lines so that they are formatted as code

Note
Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


Could not open input file: composer.phar
composer update
composer.phar
php composer.phar update

However, if you install it globally, you can make composer itself executable, so you can call it without php (and don't have to download it for every project). In other words, you can use composer like this:

If you don't, either download the composer.phar to your project directory, or install Composer globally (I'd recommend the latter).

If you have Composer installed globally, simply run composer update instead of php composer.phar update.

Installing Composer locally simply means that you are downloading a file (composer.phar - which is a PHP Archive) into your project directory. You will have to download it for every project that requires Composer.

It is helpful to know that there are two ways to install (and use) Composer: locally as a file in your project directory, or globally as a system wide executable.

Like a regular PHP file that you want to execute on the command line, you will have to run it with PHP:

Which basically tells the php executable to run the file composer.phar with update as argument.

Note
Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


Could not open input file: composer.phar
composer update
composer.phar
php composer.phar update

However, if you install it globally, you can make composer itself executable, so you can call it without php (and don't have to download it for every project). In other words, you can use composer like this:

If you don't, either download the composer.phar to your project directory, or install Composer globally (I'd recommend the latter).

If you have Composer installed globally, simply run composer update instead of php composer.phar update.

Installing Composer locally simply means that you are downloading a file (composer.phar - which is a PHP Archive) into your project directory. You will have to download it for every project that requires Composer.

It is helpful to know that there are two ways to install (and use) Composer: locally as a file in your project directory, or globally as a system wide executable.

Like a regular PHP file that you want to execute on the command line, you will have to run it with PHP:

Which basically tells the php executable to run the file composer.phar with update as argument.

Note
Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


composer install
php composer.phar install

After installing, make sure your PATH variable points to the directory where composer.phar is stored. This is usually C:\ProgramData\ComposerSetup\bin (ProgramData might be a hidden directory). It goes without saying, but also be sure that the PHP executable is also in your PATH variable.

I had the same problem on Windows and used a different solution. I used the Composer_Setup.exe installation file supplied by the composer website and it does a global install.

This finally works, I don't understand why I can't find this info anywhere on the composer website ... .

You can then simply call

instead of

Note
Rectangle 27 0

php Running Composer returns: "Could not open input file: composer.phar"?


composer install
php composer.phar install

After installing, make sure your PATH variable points to the directory where composer.phar is stored. This is usually C:\ProgramData\ComposerSetup\bin (ProgramData might be a hidden directory). It goes without saying, but also be sure that the PHP executable is also in your PATH variable.

I had the same problem on Windows and used a different solution. I used the Composer_Setup.exe installation file supplied by the composer website and it does a global install.

This finally works, I don't understand why I can't find this info anywhere on the composer website ... .

You can then simply call

instead of

Note