Reputation: 199
I have installed Composer locally only for one Laravel project
~/phpstorm/myproject/composer.phar
and didn't have any problem till I tried to create a new Laravel project, then I got an error:
Could not open input file: composer.phar
I tried to add the .phar file directly to the PATH, but it doesn't seem to change anything.
PATH=~/phpstorm/myproject/composer.phar:$PATH
Does somebody know how I could manage this problem without installing Composer globally? In the Internet I only found this easiest kind of solution, but it doesn't suit me, alas.
Thanks for your proposals in advance!
Upvotes: 1
Views: 5406
Reputation: 121
Another, easy option would be to create an alias for it in your shell
eg for bash:
alias composer='php ~/phpstorm/myproject/composer.phar'
Upvotes: 1
Reputation: 627
Change the name from composer.phar to composer by this command:
mv composer.phar composer
, give it execution permissions by running the following: chmod 0755 composer
or chmod a+x composer
, and put the current path to the PATH env variable in your .bashrc
or .zshrc
file, restart your terminal and it should work, or you can always install it globally. Bests! ;)
Upvotes: 2
Reputation: 1229
You don't need to add composer to your path unless you want to use it globally. You can just do
php composer.phar
Upvotes: 0