I'm trying to run composer on windows with wamp. I installed composer using the cmd prompt, and now I'm trying to run "composer update" for an SDK. However, when I type in "composer.phar update," windows asks what app I want to use to run this program. I want the command prompt to deal with it! How do I just run it through cmd, without this "what app" window coming up?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
You have to set php.exe as your default application for phar files.
.phar stands for PHP Archive
Usually .phar's take some arguments, so they are intended to be run from command prompt. Linux/bsd/Osx shell or windows command prompt.
Linux .phar use case scenarios assume .phars are copied to some /bin and renamed to be without .phar extension, so you can use a php archive as if you would use any other linux command. So I recommend following way of doing the same thing with windows:
ftype PharArchive=C:\phpdev\php\php542\php.exe "%1" %*
assoc .phar=PHARFile
set PATHEXT=%PATHEXT%;.PHAR
Next time your should be able just to run windows console (keybard win+r and type cmd.exe) and type any of your .phar's like apigen.phar followed by any command and it will work
So this way lets you run .phar archives in a directory where you need to work, for example generating documentation in C:\myproject\controller without specifying full path to .phar as if you would if it's run without adding it to windows path.
To explain what commands in step 4 did:
*.phar gets treated like binary/script, and *.phar execution works as long as a *.phar file is located anywhere in %PATH%