Monday, March 27, 2006 

Enable Windows PHP Logging to a File

When installing PHP under Windows, the default option is to not log errors. These are available to view from the console but obviously coded web pages will not display these. The solution is to enable logging in the php.ini file. To do that, edit php.ini and locate the line:
;error_log = filename
First uncomment this line by removing the semicolon. Then replace filename with the absolute path to the error file (ie- C:\logs\php-errors.log). Enclose the path in quotes when you have any spaces in the name. Restart web services for the change to take effect.

Thursday, March 23, 2006 

Change the Site Identifier in IIS

In IIS you'll notice that each website you create gets a site identifier automatically assigned a random number. If you're like me, you'd like those sites to have some semblance of order. Unfortunately IIS Manager does not allow you to rename sites but if you download and install the IIS Resource Kit on your workstation, you'll find the IIS Metabase Explorer can handle this.

You should first do a metabase backup just in case something goes wrong. Then launch the IIS Metabase Explorer from the resource kit. Once open, do the following to change the site identifier:
  • Connect to your webserver by clicking the Metabase > Connect... menu.
  • Expand to the following key: LM > W3SVC and you will find your sites listed by the identifier number.
  • To change the site identifier, right-click the number and select rename. You can verify the site by going into the Root subkey and finding the ServerComment. This matches the name within the IIS Manager.
  • Once renamed you need to go into the renamed site's Root key and find the AppRoot name. That will still reflect the old site identifier in the form of:
    LM\W3SVC\xxxxxxx\Root
  • Change the numbers to reflect the new site ID number. Things like ASP require AppRoot so this must be done in order to preserve that functionality.
Once done, your sites should now reflect your new site identifiers.