Tag Archives: IIS7

Win2008/IIS7 + PHP5 FastCGI = 404 Error Messages

Hopefully this saves someone some time. I spent hours working on a resolution before I came across it.

Background: Installed Win2008 + IIS7 + PHP 5.3 using the FastCGI method (used the Windows installer to configure IIS7).

Symptoms: PHP worked fine in my Default Site but when attempting to execute any scripts in Virtual Sites or Virtual Directories, every single PHP file would yield a 404 error message.

Solution: The problem ended up being that the ‘open_basedir’ config variable from the php config file is applied to ANYWHERE that PHP is run…regardless of what the actual home folder should be for a site (PHP picks up the basedir during installation and statically enters it in your php.ini file). The default ‘basedir’¬†will be¬†whatever the root of your ‘Default Web Site’ in IIS is (usually c:\inetpub\wwwroot\). If you comment out this line (enter a semicolon before the line) and restart IIS, it will solve the problem. If you’re running PHP as a FastCGI module, you’ll actually have to rename (or copy) the php.ini file to a file named ‘php-cgi-fcgi.ini’ in the same folder as your php-cgi.exe executable. Be sure to restart IIS!

Share on Facebook