PHP on IIS Servers

First post for a while.  Sorry for the silence people, but i’ve been looking after my fiance who was injured whilst at work and suffered a broken nose.  She’s feeling much better now and is just as beautiful as always 🙂

Anyways, today’s incredible irritant (this blog should be called 10 things I hate about IT.  Or maybe 1,000,000 things…) is migration of web applications.  Its a pain.  Turns out we need to downgrade one of our servers operating systems to save on operational expenses, so this means building a new downgraded server and copying all the web applications across and getting them set up.  Some of these web applications havn’t been looked at since they were first created.  Two or three years ago.  By people no longer employed here.  In a foreign language. On paper tape.  In cobol.

Ok, so maybe not quite that bad (PHP, not cobol), but I discovered that sometimes very simple things can be a pain in the ass.  This post goes out to anyone who comes across the “Dynamic loading module error” problem when moving a php mssql application.  There are a few things they dont tell you in the manual.

First of all, the installer version of php 4 doesn’t come with any of the extensions.  That means no mssql module to load.  That explains why I couldn’t load it ;).  So you have to download the zip version and extract the extensions to your php directory, then set up the php.ini file so it points php to the right extensions directory.

Then it loads right?  Yeah.  right.

No, it doesn’t.  Turns out several of the extensions (including, of course, MSSql) require extra dll libraries to run. Thats fine, searching eventually led me to a passage in the online php manual that said this and I found the required dll in the /dlls directory of the .zip file.  I placed it in the default php directory, where the loader will find it, and try again.  Woot! Loads up nice.

Doesn’t work though. Hm.  I’m getting a “can’t connect” error from MSSql with no error message and no explanation.  This took hours to track down – I tried different sql servers, user accounts, databases, nothing worked.  I checked permissions, obscure iis settings, tracts and tracts of google pages. Eventually, someone mentioned requiring the sql client tools to be installed on the server before mssql would work.

Huh.  Didn’t read that in the manual.  Give it a shot, install the sql 2000 client tools and sp3 update.  Still didn’t work.

Inspiration hits.  I delete that extra dll that mssql required to load.  Now, everything works perfect.

Turns out that yes, that dll is required for mssql to work. Yes, this is mentioned in the manual and a version of the dll is provided.  A version that doesn’t seem to work with windows server 2003.  It would also appear that this dll, ntwdblib.dll, is also installed, in a version that works, along with sql server client tools.

Finally, another problem solved.  Sometimes this job can be so frustrating.

Checklist for install a sql-server using php application:

  1. Install sql server client tools, with sp3 update, on the server.
  2. Use php4 installer version to ensure iis setup is properly taken care of.  I had to run the installer twice, something went wrong the first time.
  3. Get extensions from the php4 zip version and unzip to an extension directory in your php.  Be sure to redirect php.ini to point to this extensions directory, and un-comment the modules you need to use (in this case, mssql.dll)
  4. Set up php application on server
  5. Pray

One final note. Mssql.dll is not the same as Mysql.dll.  One uses microsoft sql server, the other Mysql databases.  Its an easy mistake to make.


One thought on “PHP on IIS Servers

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s