Getting a PHP CLI on Windows

I want to do some scripting to parse the contents of the iTunes XML library and ultimitely transfer the contents to a remote server.

For my desktop I use Windows XP because It Just Works most of the time and I reckon that doing what I want under DOS is probably impossible, I don’t know [VB|.NET|Delphi|C++|or wotnot] and I really don’t have the time to learn. Also, it would be an understatement to say that from an admin point of view I am most comfortable with a linux command line and it would also be accurate to say that I know PHP, very well.

Rumour has it that I was heard saying something along the lines of “for once I wish that I use a Mac, at least then I could just cron a PHP script.”

Then I remembered Cygwin which I’ve not used for some time. So, I download it and run setup.exe. I agree with all of the defaults then add a few things like Vim, links, ping, gcc and the build tools.

I use links to grab a copy of PHP 5 and extract it into the build directory of my home folder, which is where I compile everything on any machine so I know where to find it again.

Initially I just run ./configure to see what was missing. The following list was made by re-running ./configure everytime the build script couldn’t find something which is a bit of a drag as you have to run the setup.exe everytime.

  • flex
  • Bison
  • libxml2
  • libxml2-devel

Not as easy as I first thought, then I reslised that I was having a blonde moment.

Try 2:

Download the *Win32* binaries, extract and place the php.exe file in /usr/bin (relative to the c:cygwin root).

from the cmd line I type php -v:

Darren Beale@l33t ~/
$ php -v
PHP 5.0.5 (cli) (built: Sep 5 2005 15:54:44)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies

Now, that was a tad easier wasn’t it, Durr.


Leave a Reply

Your email address will not be published. Required fields are marked *