3

I was wondering what people who are developing on Windows 10 are using as webserver environment in 2018? I have had ok results previously using ampps, but I'm having a lot of problems with Craft 3 as of lately. With 500 internal server errors etc. Also, I'm developing on several PCs, syncing the projects with Git.

A friend of mine recommended Laravel Valet and homestead, but he's on Mac. And installation on Windows seems to be a lot trickier. I've tried Mamp too, but have really bad experience with that one.

4
  • I've used XAMPP for Craft 2; just trying to get Craft 3 up and running locally for the first time today, with no success yet. [insert shrug emoji here]
    – Sandwich
    Apr 18 '18 at 15:00
  • Not sure if this could eventually count as primary opinion based question => reason to close... however I use XAMPP. I never had any issues with installing Craft 2/3 or anything else. XAMPP for the win. I don't even know there are any issues at all while installing Craft Apr 18 '18 at 15:07
  • As a follow-up to the issues I had been encountering, they were due to running multiple PHP versions from one XAMPP install. PHP 5.6 (which XAMPP installed with) came with the proper Windows-formatted paths in php.ini, but when I added PHP 7.1 and 7.2 manually, I didn't change their paths accordingly. Windows needs the drive letter before the path; merely referencing the root via \ is insufficient, you need c:\ (or whatever drive letter is relevant).
    – Sandwich
    Apr 18 '18 at 16:45
  • FWIW, I do the majority of my Craft dev on Win10 using native IIS and standalone PHP, MySQL/PostgreSQL without issues.
    – Brad Bell
    Apr 18 '18 at 20:57
1

First of all, I am also a Mac user. But these should be available for Windows too.

Start reading about virtualization. So, you won't install the web server directly on your machine but on a virtual box installed on your machine.

A good starting point could be vagrant (which is becoming a bit antiquated more and more, but which is still worth a try since it's working like a charm).
What's getting more and more into many developers' focus is docker. Many of my customers have been introducing it in their developer teams the last years.

Hope that helps. It's a lot to read though…

1

Virtualization is a good idea. This way you can easily replicate your environment on different machines.

I would recommend using Docker as well. I personally use Laradock as development environment. But you could use other or build your own. Which I don't recommend for beginners.

So here is how to start: Install Docker, install Docker Compose, download Laradock, configure it and start MySQL and Nginx/Apache. PHP starts automatically.

Note: When you set up your DB connection in Craft's config remember it is not localhost but mysql. Because this is the name of the running MySQL container.

3
  • offtopic Hi there, I cannot not comment and must say "hello" to a fellow whose heart is beating for HRO, apparently. As a born Rostocker (living in Hamburg right now) I just have no choice. To make a long story short: Moin moin, Hanseat! :)
    – Arvid
    Jul 11 '18 at 14:00
  • Moin moin back! Tried to pm you but man, your contact is hard to find. To stay on topic, what kind of projects do you do with Craft, in a virtualized development environment of course :)
    – Johannes
    Jul 14 '18 at 12:04
  • Can't tell in detail due to NDAs with my customers. Mainly we use Craft to build usual websites, also for pretty big companies (as well as small ones, of course), then there are content hubs and websites for ad campaigns. Actually we build everything with Craft where the company needs an easy-to-use admin panel, multi-lang-support and not that much of individual development (which I personally prefer Symfony for). In single cases we use WordPress instead (only if explicitly requested for several reasons). … PM? Yeah, that's a missing feature on StackExchange, right? Try "arvid@" my website.
    – Arvid
    Jul 14 '18 at 14:30
1

I just use the included IIS on Windows 10 for development. Install MySQL and PHP and all runs fairly smoothly.

Just recently recently configured this on a new Win10 machine and made a note of another couple of points:

  1. Make sure that IIS_IUSRs has full permission to: c:\Windows\Temp and the directory where you will hold your development websites.

  2. After up and running if you try to update a plugin within the Control panel you might get a curl error. This should resolve it: https://martinsblog.dk/windows-iis-with-php-curl-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate/

All running smoothly now!

1

Edit: I would now recommend checking out Nitro 2! A tailored development environment for Craft, by Pixel and Tonic themselves. It is based on Docker but does most of the heavy lifting for you, so you don't even have to worry too much about that side.

https://craftcms.com/docs/nitro/2.x/

I'll leave my original rationale and info around issues with Windows environments and why something Docker based is the way to go.


I've had a bit of experience with development environments on Windows and it can be a little bit tricky compared to macOS or Linux, because ultimately the Windows filesystem tends to be a problematic for virtualised setups, which I'll explain in more detail below.

First I would say you want to use virtualisation despite my initial statement above. No one should be having to locally configure any form of dev environment these days, messing around with config files etc. MAMP while it does provide GUI and easy way to tweak it, no one has time for that. You ideally want to have a repeatable and easy one command provision process, where all of this is done for you. You want to be able to completely tear down your dev environment and be able to rebuild it in a matter of minutes not hours.

I've tested Vagrant, Nanobox and more recently Docker on Windows. I would recommend Docker because of it's WSL2 ties now. Previously Docker on Windows relied on Hyper-V but now with WSL support (Windows Subsystem for Linux) Docker becomes more attractive and much lighter weight. Because Docker and WSL are tied to the same Linux kernel running within Windows (Yes Windows has a Linux kernel running inside itself now!) meaning performance wise you'll get much better response times from apps than Vagrant or Nanobox can ever achieve. I found Craft 3 to be horribly slow (even with dev mode off) and I'm afraid it is combination of the VM abstraction layer and the Windows filesystem (it sucks for VMs).

Vagrant and Nanobox both struggle because they require a full VM layer pointing to a Windows filesystem mountpoint, this is where your dev environment is hurt on Windows. The Windows filesystem is a pain in the arse when virtualisation is concerned. You will find issues with certain tools i.e. npm with symlinks and many other Windows specific stuff. There's even been specific issues directly impacting Yii2, which did get fixed, but just shows you that Windows can be evil: https://github.com/craftcms/cms/issues/4355

Docker has the advantage of WSL support and having the concept of containers. So think all the services needed like Apache/nginx (webserver), MySQL/Postgres (database backend), PHP-FPM etc, these can all be in their own containers rather than a single VM in comparison. This has the advantage of being able to swap out or change only certain elements when needed. Example: Fancy switching from Apache to NGINX? Easy, just change you web server container. Want to go to Postgres instead of MySQL? Cool, just switch your DB container.

With Docker, you can literally script the entire process with a docker-compose.yml and Dockerfile to automate the build and provisioning of a development environment. There are also great resources from the community around Docker. Even Pixel and Tonic have official purpose build docker images for Craft CMS 3 development.

https://github.com/craftcms/docker

The documentation on how to use them is a little lacking currently, but there's also an excellent walkthrough from Andrew Welch around a complete walkthrough of Docker environment: https://nystudio107.com/blog/an-annotated-docker-config-for-frontend-web-development, other Craft CMS developers have shared their Docker setups as well. A lot of them share the same common foundation, but may differ in some areas depending on requirements.

The end result, you can literally run one command docker-compose up and everything else is provisioned for you. So that's why I'd recommend Docker. While it is a VM like Vagrant and Nanobox, it's about as lightweight as it can get, coupled with WSL2, I'm pretty sure it's going to be the fastest environment as well (aside from running natively on something like IIS).

The alternative would be running an environment on the host directly without virtualisation to avoid issues with volume mounts and such, this however puts more liability on yourself to configure things however, which as per my original statement, nobody has time for that! But you could even use IIS which is the native web server for Windows.

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.