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 thought I'd spend a little time sorting out how to connect to MSSQL server using PHP on my Windows 2008 box. I now have my system set up in VMWare Fusion and use SMB to map the wwwroot directory to my OS X environment so I can use my familiar IDE. I am also using Safari for OS X to view the webpages having set up a local entry in my /etc/hosts file.
I quickly noticed that if I made an error, then I'd get back a generic IIS error in the browser:
However, if I viewed this site in IE on the VM using http://localhost as the address, then I could see the actual error.
The solution to this is in the ISS Manager program. Select the server in the left hand tree and then choose the Error Pages option in the main pane. Choosing Edit Feature Settings... in the right hand pane gives access to this window:
I changed to Details errors and then started seeing the real error in Safari. Obviously, on a live server, you'd probably want to use the default option of Details errors for local requests and custom error pages for remote requests. It would be tidier if I could set the 192.169.0.x IP range as "local" though.
Getting the MSSQL server connection working is the subject of another post now :)