Can’t Install Drush On Windows 10 With XAMPP

PROBLEM 0: COMPOSER
I’ve been using XAMPP for years. It’s stable, it’s reliable, and most of all, it’s easy. I can install local instances of Drupal, WordPress, whatever. I mostly use it for PHP. It’s very easy to install and get up and running in no time.

Well all that went to shit when I needed to use Drush 8 (for Drupal 8). Since it’s a Windows application, it isn’t very easy to install such things as Composer and Drush. Drush now has the prerequisite of Composer so Composer MUST be installed.

SOLUTION 0: COMPOSER
This was a headache in and of itself. I tried to install the windows package but I kept getting:

The “https://getcomposer.org/versions” file could not be downloaded: SSL operation failed with code 1.

I had to install it via the shell in WAMP:

curl -sSk https://getcomposer.org/installer | php — –disable-tls

That worked! I got around the SSL issue.

I had to copy composer.phar to the C:\xampp directory. Composer is currently installed at C:\Users\xxxx\AppData\Roaming\Composer.

I also needed to create a composer.bat file with the following in it:

@ECHO OFF
php “%~dp0composer.phar” %*

I put this in the C:\xampp directory and ran it. Composer now works on any directory.

But the story isn’t over yet. I still had to install Drush 8!

PROBLEM 1: DRUSH
I followed the Drush installation instructions found on modulesunraveled. I tried and modified BOTH my User variables and System variables. No luck. Anytime I tried to do a drush command I would get:

‘drush’ is not recognized as an internal command

From the shell. It would work if I was in the C:\Users\xxxx\AppData\Roaming\Composer\vendor\drush\drush directory but that was no good.

SOLUTION 1: DRUSH
I swear to god nothing comes easy anymore! After DAYS of trying to figure out how to install Drush via Windows with XAMPP I finally reached the solution this morning. I tried a variety of things so I’m not sure what exactly did work about it.

I thought it may have to do with the fact that drush is under C:\Users so I decided to move it under XAMPP so I copied it C:\xampp\php\lib\drush. Don’t judge me. I was desperate.

Then I modified my system variables to add EVERYTHING (i.e. Control Panel –> System –> Advanced system settings –> Environmental Variables). My Path for System variables now looks like this:c:\xampp\php; c:\xampp;c:\xampp\php\lib\drush;c:\xampp\mysql\bin

Like I said, don’t judge cause it works.

Thanks to a forum about a Composer issue (the composer.json wasn’t found when I tried to do composer), I found what then was able to make it all work.

I cd’d into the Drush directory (i.e. cd C:\xampp\php\lib\drush) and did a composer update. All of a sudden all these things started to install which I took as a good sign!

I then tried to do drush which didn’t do anything but dr did! I now get information if I do dr in any directory!

I hope this can help someone else out!

SPECIAL COMMENT
There are NO WORDS about how difficult this process is. I’ve been a developer for many, many years. Drupal 8 is one of the most complex CMSs and the fact that we need to use Composer and Drush along with it is sheer ludicrous. The web and web technologies have totally changed from just a few years ago.

We shouldn’t make things harder we should be making them simpler! Back in the day all you needed was PHP and a MySQL (or any other kind of DB) backend and you were good. Now it’s gotten to the point where you have all these dependencies and if one thing doesn’t work, it all goes to shit.

This shouldn’t be how it is now. Things aren’t documented. Other developers have lots and lots of issues just getting the simplest of applications to work. Why the fuck did they go and make things so complicated? It’s supposed to be easier than this. It’s supposed to be simple. Life is hard enough!

I remember installing MSSQL for free back in like 2008. Everything came with it and it was easy to do. Now you need MSSQL as well as the UI and you have to do all these things just to install it. I needed help from our IT department!

Life SHOULDN’T BE LIKE THIS. Stop making life harder for others. Make it easier and for god sake document your fucking shit. (Ex. LOOK AT THE GOD DAMN readme.md FILE FAQ FOR DRUSH! WHAT THE FUCKING FUCK???)


Deprecated: Function get_currentuserinfo is deprecated since version 4.5.0! Use wp_get_current_user() instead. in /home/niles38/longlivethemonkey.com/syntaxnotes/wp-includes/functions.php on line 6031

Leave a Reply

Your email address will not be published. Required fields are marked *