PHP On Windows 7

Last week I decided to take the plunge and install the release candidate of Windows 7 on my office workstation where I happen to do a lot of web development and testing.  My development stack consists of Netbeans IDE, PHP 5.2.8, and IIS 7.  There are plenty of other quality tutorials out there explaining how to get PHP working on IIS 7 so I won’t bother beating that particular dead horse.  However there was one quirky difference between installing PHP on Vista and installing PHP on IIS 7 that developers may want to be aware of before they follow my lead.

The Problem : Editing php.ini as a Standard User

During the process of installing PHP on Windows 7 you will be required to copy php.ini into the C:\Windows directory, and  later point you’ll most likely need to edit this file to suit your needs.

On Windows Vista I simply wasn’t allowed to edit files under the \Windows directory (specifically php.ini) when logged in as a Standard User. Windows 7 was more than happy to allow me to modify and save this file in the same location, logged in with the same credentials. But even after restarting IIS my configuration changes never took effect.

The problem was caused by something called the Virtual Store, an application compatibility feature that existed in Windows Vista but works a little bit differently in Windows 7.  Where Vista wouldn’t let me edit this file at all, Windows 7 happily lets me modify it but transparently saves the changes in a different location. The updated php.ini was stored in %UserProfile%\AppData\Local\VirtualStore\Windows\php.ini.  The service account which IIS runs under can’t see this updated file

The Solution: Run As Administrator

When editing php.ini, don’t simply double-click it and make changes.  You must run your text editor as an administrator to edit the file, otherwise the changes will be saved to the Virtual Store.

2 replies
  1. Brian Reich says:

    Glad I could help! The Virtual Store is a boon for system administrators but causes a lot of confusion in situations like these where a config file is edited under a different user account than the one that will actually be executing it (the System account).

Comments are closed.