30 May 2013

As a LAMP sysadmin/developer, I have spent plenty of time tuning my IDE and SSH clients to align with my particular workflow and other preferences. For testing purposes and various other reasons, I am committed to a Windows workstation without any unnecessary virtual machine usage. However, there are times when local work just makes more sense and/or the lack of an Internet connection precludes accessing Linux utilities via a remote server. I set out to tailor an installation of cygwin to let me perform local CLI development using the exact same tools and techniques that I use for remote development.


Be able to SSH to my local Windows 7 machine via Cygwin with the objective of running standard Linux-style scripts, including PHP tools that can be repurposed from remote Linux environments.

Installation Process

I omit PuTTY and SSH general information. If you are not already familiar with both technologies, then Cygwin is less likely to make sense for you.

  1. Download the Cygwin setup program and launch it
  2. During Cygwin setup, select the following packages:
    1. cygrunsrv
    2. openssh
    3. gcc-g++
    4. make
    5. libxml2-devel
    6. curl
    7. vim
    8. nano
  3. In the Start Menu, right-click on Cygwin Terminal and Run as Administrator.
  4. In the Cygwin Terminal, run the following three commands:
    1. ssh-user-config -y
    2. ssh-host-config -y
    3. cygrunsrv -S sshd
  5. Convert SSH key to a PuTTY PPK file
  6. Configure PuTTY to connect to localhost using that new PPK file
  7. Install PHP
    1. Download PHP source (I tested with 5.3.25)
    2. SSH to localhost (or use Cygwin Terminal if you are going out of order)
    3. Change directory to where the source tarball was downloaded (e.g., `cd /cygdrive/c/Users/YourName/Downloads/`)
    4. Extract the source code folder and go into it (e.g., `tar -xzf php-*.tar.gz; cd php-5.3.25`)
    5. Configure the compilation: `./configure`
    6. Compile PHP: `make; make install`
  8. Within SSH (or the Cygwin Terminal), test it with `php -r 'echo date("Y-m-d");'`

blog comments powered by Disqus