0

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?

3
  • Please finally try DDEV.
    – leymannx
    Nov 17, 2021 at 10:22
  • 1
    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.
    – Kevin
    Nov 17, 2021 at 10:49
  • 1
    Acquia dumped XAMP, too: docs.acquia.com/resource/archive/dev-desktop
    – 4uk4
    Nov 17, 2021 at 10:59

1 Answer 1

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.