Score:0

Is it possible to use WSL-based Drush on a Windows 10 XAMPP and if so how?

mu flag

I currently use Drupal 9 but concepts about Drupal 10 may be useful.

I use Windows 10 Home with XAMPP and C:/xampp/htdocs is my web application root.

I want to establish a minimal Drupal development environment on my Windows 10 Home instance by installing Composer and then Drush.

I can use WSL to install both Composer and Drush but then a question arises:
If WSL only effects its own Linux environment, how could I use WSL-based Composer and Drush to effect the XAMPP Windows environment?

leymannx avatar
ne flag
Please finally try [DDEV](https://ddev.readthedocs.io/en/stable/#installation-or-upgrade-windows-wsl2).
Kevin avatar
in flag
This will be a whole lot easier if you dump XAMMP. You aren't going to want this hassle of installing Drush and Composer on Windows.
4uk4 avatar
cn flag
Acquia dumped XAMP, too: https://docs.acquia.com/resource/archive/dev-desktop/
Score:3
cn flag

Let's think about what is actually going on here.

With XAMPP, you are basically running an Apache server inside a Windows program.

With WSL v1, you have a Linux virtual machine running within Windows that has drush, composer, etc.

With WSL v2, you have Linux running in Hyper-V (MS hypervisor), so you get near-native Linux performance with less virtualization overhead.

So, basically the question becomes "How do I access a server running in a Windows environment from a Linux environment inside the Windows environment?"

Depending on how comfortable you are with firewalls and proxies and things, and depending on how your computer is already set up, configuring this may not be too hard-- but it could also be a real mess.

composer

For composer, you just need access to your Windows files from within Linux.

With WSL, Windows C: drive should be mounted at /mnt/c in Linux. So you can just cd to the Windows directory that has your files from Linux and run composer commands.

drush

For drush, you'll need to set up aliases and connect to the XAMPP server. You may also have to open some ports in your Windows firewall, which can present a security risk. The details of this are out of scope for this site (better fit for Server Fault).

a better solution

As @leymannx mentioned, DDEV is a solution that provides a solid Drupal local development environment with little configuration, and I personally use lando, which has served me well for the past 5+ years. They are both free (both open source and free as in beer), and give you solid defaults; you'll probably save a lot of time not setting things up for yourself.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.