Finalising installation

24th April 2009

This post is part of a series about my experiences building a PHP app for Windows Server 2008 and IIS 7 for the European WinPHP Challenge 2009 which is sponsored by iBuildings, Microsoft and Leaseweb.

I finally had some time to finalise my Windows Server 2008 installation.

Firstly I fixed a couple of annoyances. I turned off the very stupid "Hide extensions for known file types" option in Explorer. It may make sense for the consumer OS, but it's a pain on a server. I also turned off IE's "Enhanced Security Configuration" for Administrators. No doubt I'm supposed to download via another computer and upload to the server, but that's more hassle than I'm prepared for.

The PHP installer

To finish the PHP installation, I followed a tip from fellow competitor drydenmaker and grabbed the installer from windows.php.net(NTS, VC6 for PHP 5.2.x) and installed what I needed. It was trivial and "just worked" now that I know about ensuring that all relevant services are turned off before you do anything on a Window box!

Very oddly, the command line executable, php.exe, wasn't installed by default so I added that too, along with PEAR. Both of these, along with PDO_ODBC really should be installed by default. I turned off the old-fashioned MSSQL extension too as I won't be using it. I was quite impressed that the PHP installer correctly removed the extension from the ext folder and also removed the reference from the php.ini file.

To install PEAR on Windows boxes, you run go-pear.bat and then installing PHPUnit is easy.

SQL Server Driver for PHP

The new way to connect to SQL Server is using the SQL Server Driver extension. Surprisingly it wasn't installed by the Windows Platform Installer for me. The installer was a little odd as it asked me where to place the extracted files! I didn't know so guessed on C:\Program Files\PHP\ext, which failed claiming low memory! I guessed it really meant a permissions problem, so ran it again and specified a temporary directory on the desktop. I then moved the correct DLL to the PHP/ext directory and modified php.ini myself to load the non thread safe version.

The lines to add to the php.ini file are:

[PHP_SQLSRV]
extension=php_sqlsrv.dll

Incidentally I had trouble trying to get permission to save php.ini from notepad. Even though my user is an administrator (according to control panel -> user accounts) and the security tab on the file properties said that administrators had write access, I couldn't save. In the end I explicitly added my user to the list of permissions. Clearly my user isn't a real administrator and I'll need to find out how to fix that at some point.

Xedbug

Finally, for PHP, I downloaded the Xedbug DLL and installed that by placing it in C:\Program Files\PHP\ext with the following php.ini configuration lines at the end:

[XDEBUG]
zend_extension="C:/program files/php/ext/php_xdebug-2.0.4-5.2.8-nts.dll"

I started IIS up again and my phpinfo() output showed that all was well. As an aside, it would be nice if IIS Manager told you that it had done something when you press the Restart button :) A line in the status bar would be enough. On the command line phpunit also worked :)

Subversion

We're not going to get far without some form of version control, and TortoiseSvn just installed with no problems.

Leaseweb server

To get at the Leaseweb server, I installed Microsoft's Remote Desktop Connection Client for Mac which seemed to work well. It's quite Mac-like :)

I logged into my remote server and discovered a "Shudown Event Tracker" window waiting for me along with a note that I need to restart Windows because some updates have occurred. Obviously I have no idea why the server shut down unexpectedly... hopefully it won't happen again. Not a great welcome to my new server though.

Installing PHP on Windows Server 2008

21st April 2009

This post is part of a series about my experiences building a PHP app for Windows Server 2008 and IIS 7 for the European WinPHP Challenge 2009 which is sponsored by iBuildings, Microsoft and Leaseweb.

Installing PHP on IIS is easy once you have download the Microsoft Web Platform Installer 2.0. I had a slight hiccup in that all I got was a blank page with a little yellow triangle at the bottom with "Error on page" written next to it. One reboot later and it was happy though.

I then press the "Download" button and got a security alert as apparently my current security settings wouldn't let me download the file. After adding http://download.microsoft.com/ to the list of Trusted sites in IE's options, it downloaded. Not the smoothest of experiences and I'm very surprised that downloads.microsoft.com isn't set up as a trusted site by default. It would have been nice if the security alert message had included a note about what to do to fix it too.

Before running the platform installer's setup program, I created a snapshot within VMWare Fusion just in case. Once I ran it, I got a nice list and PHP 5.2.9-2 is a simple check and Install away:

WebPlatformInstaller.jpg

I also discovered SQL Server 2008 Express hiding in the Web Platform -> Database tab and URL Rewrite 1.1 inteh Web Server section so I installed those too.

Interestingly, it recommended that I install SQL Server with Mixed Mode Authentication and prompted me for an sa password. After downloading some bits, it needed a reboot and after I had logged in again, it continued downlaoding and installing. Then this happened:

WPI Failure.jpg

One of the really nice things about the PHP community is that even though this is a competition, all the competent competitors are helping me out. I stopped the Web server via the IIS Manager, and the Windows Process Activation Service in the Services tool and tried again. This time it completed.

Now to test it. Being a coward, I rebooted! Why do I have to tell the computer the reason though?!

The web root folder for IIS is c:\inetpub\wwwroot. I navigated to it using Explorer and then did a right click -> new and discovered that the only choice was Folder. I checked my XP VM and that definitely has Text file as an option for new. I did it the other way using Notepad :)

Navigating to http://localhost/info.php gives me this:

W2K8_PHPinfo.jpg

YAY!

Interestingly, the old mssql extension is enabled, along with mysql and mysqli, but no PDO and no sqlsrv. Very odd. As the PHP installer didn't include all the dlls in the ext/ folder, I think I'll be heading for the zip file tomorrow!

Oh, one other Windows Server oddity. When I press "Close" on the windows that opens when I login, it disappears and a "server manager" window opens in its place! I didn't ask for this window, so why does it appear?!

Installing Windows Server 2008

21st April 2009

This post is part of a series about my experiences building a PHP app for Windows Server 2008 and IIS 7 for the European WinPHP Challenge 2009 which is sponsored by iBuildings, Microsoft and Leaseweb.

One benefit for Microsoft with this competition is that all the participants have to blog about their experiences. This should gain MS some exposure, though I wonder how much will be negative from those of us more familiar with nix.

No doubt my feed will have a few Microsoft centric posts over the next week as I get to grips with the environment. Hopefully it'll then settle down as I talk about developing PHP :)

I have a fair amount of experience using Windows XP as a PHP development environment from about 18 months ago or so when I converted to OS X. I've also flirted with Vista for a week when my MacBook Pro was in for repair. My overriding memory of Vista was forever clicking boxes about security that I stopped reading. It will be interesting to see how Windows Server 2008 fares in comparison.

My general plan is to create a new VMWare Fusion virtual machine for Server 2008 and then share the folder where the app will live via SMB back to the Mac so that I can develop with familiar tools. It will be interesting to see if I can use subversion on the mounted drive, or whether I need to commit from within the VM.

Creating a new VM in Fusion is simple enough and it started the installation automatically for me. As I don't have a product key, I left that blank and started the install. The installer then asked me which edition of Windows that I wanted. The choice was Full installation or Server Core Installation. The second sounded cheaper, so I wondered if that's what we were going to be given. Off to the web to find out what the difference was.

Microsoft's website is a maze of non-information. I started with the Compare menu item within Product Information, but that was all about comparing Windows to Unix. Undaunted, I tried the Editions->Compare Features menu, but that gave me a table about the differences between Enterprise, Datacenter, Standard, Foundation, Web and Itanium versions of the server using lots of acronyms. The Compare Server Roles option and Compare Server Core Installation Options also didn't help answer my question. I gave up on the Microsoft website.

As an aside, how on earth does anyone actually buy the correct version of Windows for their server?

Having abandoned MS's site, I went to Wikipedia's Windows Server 2008 page and found out what I needed immediately:

Windows Server 2008 includes a variation of installation called a Server Core. Server Core is a significantly scaled-back installation where no Windows Explorer shell is installed. All configuration and maintenance is done entirely through command line interface windows, or by connecting to the machine remotely using Microsoft Management Console.

So I picked Full Installation as I'm nearly sure you can't get Microsoft Management Console for OS X...

Whilst waiting for the installation, I searched some more on the MS website and found this MSDN article which also answers my question. I'm really hoping that I can navigate php.iis.net and windows.php.net better :)

Once installed, I quite liked the simplicity of the login screen and desktop with a plain blue background and the "classic" look at feel the to windows. Of course, the first thing I saw was a "Windows requires your permissions" dialog box so it's not that much better than Vista!

Windows2008_Desktop.jpg

The "Initial Configuration Tasks" window is easy enough to work through as it's nicely laid out in steps. Interestingly I needed to click yet another permissions box so I could set up the networking, but it allowed me to change the computer name and workgroup without a murmur (other than a reboot). Rebooting is a popular past time whenever I do anything vaguely sysadmin related on Windows XP VMs. I was quite surprised how often I've rebooted already on this Server box.

Once I've got all the updates (more permissions boxes and restarts...), I'll install PHP...

WinPHP Challenge

20th April 2009

This post is part of a series about my experiences building a PHP app for Windows Server 2008 and IIS 7 for the European WinPHP Challenge 2009 which is sponsored by iBuildings, Microsoft and Leaseweb.

For some insane reason, I decided to enter the WinPHP Challenge and having been accepted, I now need to actually write an app! It's not like I'm not already way too busy or anything...

The main reason that I decided to do the competition was so that I could learn about running PHP on IIS, particularly learning the .htacess equivalents. Also getting more familiarity with SQL Server is useful. We are getting more enquiries from potential clients about running our software on these technologies, so being better informed is a good thing. I'm expecting that our software will run pretty much as-is though because PHP is a cross-platform solution.

The server

First order of business will be to get a VMWare Fusion instance of Windows Server 2008. Apparently, MS are sorting out a license which is good. Does anyone know if I can "upgrade" the trial version or will I have to reinstall from scratch? As I'm on a very slow ADSL connection (around 1.3MBps, it may take a while...)

Incidentally, I see that PHP is mentioned on the Windows Server 2008 home page in the tag line "Manages ASP.NET, PHP, and everything in between.", so may be MS is serious about making Windows a first class hosting platform for PHP sites too. That can only be good for us when selling into companies with a Windows-centric IT department.

The application

I currently have two choices of app to write and I need to decide this week :)

Firstly, I could take the example app in Zend Framework in Action, Places to take the kids and work it up into a usable application. This would have the advantage that I could integrate Zend_Application into it and show what I would do differently now compared to what's in the book. We could also explore how to do dojo for the Ajax stuff.

A second choice is to write an SQL Server inspector/administrator along the lines of a very basic phpMyAdmin. Obviously phpMyAdmin is very mature, so I don't set my sights that high! It would however be useful if I had a tool that let me view the structure of MSSQL tables and be able to query the data in them. Related to that, the ability to dump all tables to a single file of SQL statements would be handy as I can't seem to find a way to do that in the SQL Server Management Studio Express tool.

Decisions... decisions...

The photo

One decision that I've actually made is that this blog needs more pictures! It was sunny today in Birmingham, so here's a picture of people enjoying the sunshine in the cathedral grounds:

Cathederal grounds