Install wp-cli via laragon terminal?
-
Hi there, hope you can help? Trying to install wp-cli (for the 1st time) via the laragon terminal using the instructions from the official wp-cli guide: https://make.wordpress.org/cli/handbook/installing/
Everything worked until the very last command:
sudo mv wp-cli.phar /usr/local/bin/wp
^ fails..
'sudo' is not recognized as an internal or external command,
operable program or batch file.So i then tried manually moving the file via windows explorer to
C:\laragon\usr\bin
..then typed
wp --info
into terminal to which i get:'wp' is not recognized as an internal or external command, operable program or batch file.
-
@Marc-Thornton :
sudo
is a command in Linux. You can checkbin\composer
to see known how to handle.phar
file.
-
Sorry, having difficulty deciphering what you meant? I understand that .phar is a compressed file but what did you mean by 'check'? Googling that led me to this article
I downloaded composer using these instructions
..so now I have the following in my laragon/www/ directory:
composer.phar
wp-cli.pharTyping:
php wp-cli.phar --info
Does output the right info
But I still can't bindwp
to replacephp wp-cli.phar
?...and none the wiser as to how composer.phar comes into this?
FYI -
php bin/composer.phar
producesCould not open input file: bin/composer.phar
and the same withphp bin/wp-cli.phar
. Typing the filename creates an OS modal for me to select the application to open it with.Thanks for your patience.
-
Shall i just install Windows Subsystem for Linux and follow the original wp-cli install guide?
-
I'm pretty sure the wp cli instructions are assuming you're using a linux machine (or at least a linux virtual machine or subsystem). So they'll need to be tweaked a bit, seeing how Laragon is running on Windows. Not sure how yet, just learned about Laragon today!
-
Here's some instructions for installing WP CLI on windows: https://deluxeblogtips.com/install-wp-cli-windows/ which should help (I haven't gone through them all yet)
-
@mnelson4 thanks, look forward to giving that a try in the morning!
-
Thanks @mnelson4, after seeing the long article from you link. I decided to create a tutorial for that. It is very easy with Laragon.
You can check it here:
https://forum.laragon.org/topic/1039/tutorial-how-to-add-wp-cli-to-laragonSorry @Marc-Thornton, I was busy improving the Auto Generated SSL feature for Laragon 3.3.1 and did not notice that you were still stuck on it. I hope this helps.
-
@Marc-Thornton : I've also updated with the lazy way:
cd C:\laragon\usr\bin && curl -L -O https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && echo @ECHO OFF > wp.bat && echo php "%~dp0wp-cli.phar" %* >> wp.bat
-
@leokhoa ah that's so easy! works great, appreciated.