WSL & LAMP part two

As mentioned before, I’m restarting my windows-based LAMP developer experience after a long sojourn in MacOS. This post is meant to look at where I am a few weeks in, and tips/tricks/problems I’ve encountered. I’ll probably post a review of the actual laptop I went for later.

All in all, the experience has been quite good. I have a full LAMP stack set up and running well, with very few hiccups. Right now I have it set up to run three different sites, two custom PHP and one that runs mostly off WordPress. All I have to do to change which site I want to just off of http://localhost is edit the relevant Apache configs and restart Apache.

I’m a vim user so I haven’t needed to install any big clunky IDEs. I do have sublime which I mostly use as a giant clipboard/notes app. Everything else lives in Trello or Google Sheets, or Slack.

I did have some odd issues initially running my linux terminal – until I got used to it. I just had to get used to opening new terminal windows from within the linux app. The only other niggling issues are that you can’t seem to split the screen (something I do very rarely anyways) – and sometimes when pasting a large amount of text within vim, there’s a slight delay. That’s all!

So, all in all I’ve made the transition quite seamlessly – maybe a day or so of lost productivity while getting everything set up and moved over from my old mac.

Running Linux in Windows

I wrote this post about two weeks ago and apparently forgot to publish it… so publishing it now as a prefix to another post that will explain my new windows-based linux setup (what a weird sentence that is!)

It’s been said before, but what a weird time we live in!

As mentioned previously, I finally had to ditch MacOS as my main work OS, thanks to new machines just not matching the price and functionality (and reliability) point for me. And haven’t been a fan of the changes they’ve been making to MacOS over the years anyways…

So, I’m on day three of my (resumed) Windows journey. But, I’m a web developer primarily in the LAMP stack, and I know that I can’t just set up a dev environment within windows for that, when everything I create is hosted on Linux…

My original plan was to just set up a virtual machine in Windows and just work within that. But, thankfully I remembered that there’s now WSL (Windows Subsystem for Linux) that could be an option… and so far, so good!

WSL lets you run linux within Windows, without the need for a virtual machine, or Docker or whatever. Basically, one it’s set up – you can have a bash prompt – and once you have that, you can install all sorts of things you need to do your job efficiently.

I’m not going to go through the whole process because there’s plenty of good guides out there – I’ve linked to a few at the bottom of this post. Instead, I’ll focus on a couple of the gotchas that held me up as I was getting everything set up.

File Permissions
Once I got the LAMP stack up and running, I grabbed all my files off my old macbook and set them up on the new laptop. But, the first I ran git status it told me every file had changed. Great, that’s not a good sign! My first thought was the old issue with newlines – but that’s not an issue using WSL since you’re inside linux anyways… Turns out there’s some file permission weirdness, and all of my files now had 777– and git thought I wanted to change all those files’ permissions – probably not a good plan! Turns out setting a simple git config option to ignore permission changes took care of that problem:
git config core.filemode false

Getting a Decent Terminal
You can use the built-in windows terminal… and it certainly is leaps and bounds better than last time I used Windows (*cough* Vista) so there’s that. I should probably explore it more.

I tried a few other terminals recommended in one of the guides, w/mediocre results. Some felt slow. And many of them had problems recognizing the arrow keys in vim – I can get by without them but I tend to alternate between the arrow keys and other options when moving around in vim without much though, so having the arrow keys suddenly not working was jarring.

For awhile I was using the Hyper terminal because it looked good and handled arrow keys just fine – but it felt a little slow and had the occasional weird glitch. I guess it’s built with javascript/css, etc which is kind of cool. But, contrary to popular belief we do not have to use javascript (of all things) for everything under the sun…

So, I followed this guide to set up the linux xfce terminal, running via X. I was a little leery at first, flashbacks to my early linux days with X (think pre 2000) but of course things have gotten much easier since then! I’ve gotten it all set up and about to embark on a work session with the new setup – we’ll see!