IIS 7 and Above
PHP Setup on IIS 7
Last post Jul 21, 2010 03:51 PM by don.raman
Jul 20, 2010 03:48 PM|sconos|LINK
Hi, I've setup PHP on IIS 6.0 a number of times before and never had problems like I am having with PHP via FastCGI on win 2008 and IIS 7.0
OK - Server is an R2 SP2 server running 32 bit, Install IIS 7, and added ISAPI Filters and Extensions as well as CGI, downloaded the Web Platform Installer (2.0) and had it install Framework 4, PHP and a few other items. My perl CGI runs fine on the web
Server, But I can not get php to server, just get a blank page when I hit a simple phpinfo test page. I can see the "PHP_via_FastCGI" handler Mapping at the root of IIS.
Read up on http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/ -
Downloaded the php non-thread safe zip from the php site, exploded into c:\php - followed the config instructions and get a good output when I do "c:\php\php -info"
Went back and modified the Handler Mapping to point at c:\php\php-cgi.exe - restarted everything - and I still can not get a simple phpinfo site to come up - just a blank page.
I'm still digging, but I'm stumped at the moment ... any help would be appriciated.
Thanks - Mike
Jul 20, 2010 03:58 PM|don.raman|LINK
You installed PHP from WPI as well as NTS zip folder and to add to it ISAPI. There might be too much of configuration which you have done to configure PHP. First of all undo all that you have done. Unistall PHP from Add/Remove Program, delete C:\PHP folder
and delete all the handler mappings to *.php. If you have set any registry key to load the correct INI file, remove that too. Once you have undone all these items follow these blogs:
Jul 21, 2010 02:49 PM|sconos|LINK
I've followed you advise and so far no change ....
1. Uninstalled manual php install
2. Used Programs and Features to uninstall WPI php install
3. Deleted all instances of *.php in the IIS Handler Mapping section, then rebooted the box for good measure
4. Installed PHP again from WPI
5. ran php-cgi.exe -v - got a dialog box pop up - msvcr71.dll missing, commented out php-mssql.dll in php.ini extensions, got a Clean run of php-cgi.exe -v
C:\Program Files\PHP>%WINDIR%\system32\inetsrv\appcmd.exe list config /section:h
andlers /text:* | findstr /i PHP
Put a "test.php" file in root and it returns fine "My first php program" in browser
Put a "testphp.php" file right next to the test.php file with nothing but <? phpinfo(); ?> in it - blank page, logs say
But the testphp.php comes up blank, I have what was a running application I get a 500 on ...
2010-07-21 16:57:24 10.112.6.41 GET /search/admin/indexer.php - 80 10.113.1.5 Mozilla/5.0+(Windows;+U;+Windows+NT+5.1;+en-US;+rv:220.127.116.11)+Gecko/20100625+Firefox/3.6.6 500 0 0 1201
I've repeated this process twice so far - as far as removing and reinstalling .. no luck and no progress. Getting php running should not be this hard ...
Any direction would be appreciated.
Jul 21, 2010 03:23 PM|don.raman|LINK
I think you have done everything right.
ran php-cgi.exe -v - got a dialog box pop up - msvcr71.dll missing
Please open your php.ini file and comment the line extension=php_mssql.dll. Simply put ';' at the beginning of the line. This is the old and deprecated SQL driver to connect to MS SQL Server. Probably you will never need it. Other workaround is to install
Microsoft VC7 runtime. This will help you geting rid of the error.
Put a "testphp.php" file right next to the test.php file with nothing but
<? phpinfo(); ?> in it - blank page
See by default short_open_tags is set to Off in php.ini. This is the reason why PHP is not able to recognize testphp.php as a PHP file. Please change the content to
This should fix everything and you should be able to display the phpinfo page. Details at
Jul 21, 2010 03:41 PM|sconos|LINK
Thanks, quick reply ..
I had already commented out the extension line in php.ini and short tags was set to off - forgot that would affect the php declare in code.
Changed phpinfo for proper declare and got a phpinfo page now.
The rest of my app still gets a blank page and a 500 in the logs .. I'm running this same application code on a Win2K3 \ IIS 6 box with no problems, I can see php running now through the phpinfo display, I'm just not sure whats different between the servers
in how they are interpreting the PHP code, shouldn't really be a difference once an info page comes up PHP should just run ...
I'm going to turn on some debugging in php.ini ... if you have any suggestions let me know. thanks for your help.
BTW - The application is a Sourceforge search engine called TSEP ...
Jul 21, 2010 03:51 PM|don.raman|LINK
The rest of my app still gets a blank page and a 500 in the logs ..
Now this entirely depends on how you deployed your existing application on 2k3 on the new machine. Remember a simple copy may not work. However your PHP is configured properly. What I would suggest is that in the DOCUMENT ROOT of the site concerned put a
simple phpinfo file and try accessing it from the browser. if it display properly this means that PHP is configured properly even at that site level.
I'm going to turn on some debugging in php.ini
I would say start looking at PHP error log file which will be present at C:\WINDOWS\Temp\php-errors.log and see if PHP is writing anything there. Also look at Windows Event Viewer and see if there is any crash with respect to process php-cgi.exe.
If you are familiar with the application do a simple 'error_log' debugging. Put dummy error_log statement and see where it is failing.