Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2857
  • Last Modified:

PHP IIS Blank page

Hi,

Have installed PHP 5.3.5 on IIS 6 Windows Server 2003 standard x64 edition via manual install per the PHP documentation.

Command line php -i returns information, but file php.htm containing:
<title>
PHP Test
</title>
<?php
phpinfo();
?>

returns blank page, though the title appears

What am I doing wrong?

Thanks!
php.ini
0
mitcht
Asked:
mitcht
  • 17
  • 13
  • 6
  • +2
5 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
You need to name it php.php, not php.htm.  It will work then if PHP is configured correctly on IIS.
0
 
Brad HoweCommented:
Your extention is wrong. That is going through the html processor

change the file extention to test.php.

Cheers,
Hades666
0
 
mitchtAuthor Commented:
Changed file to php.php.  I get a 'windows cannot open the file' error.  IIS mis-configured?

Thanks for the responses!
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
aboo_sCommented:
Either rename to test.php or add this to your .htaccess file in the directory where you are running this file

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

If you do not have this file in your current directory or in root directory you can create one with notepad or maybe dreamweaver .

Hopes this helpes!
0
 
Brad HoweCommented:
In IIS Manager, did you config the PHP extention mapping?

Specifically "Manually Configure the FastCGI Extension to Work with PHP"
http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/

Cheers,
Hades666
0
 
Dave BaldwinFixer of ProblemsCommented:
I have to recommend that you do not remove the HTML handler, just add the PHP handler.  In addition, I don't believe that ".htaccess" will do anything in a stock IIS6 installation.
0
 
Brad HoweCommented:
agreed, I stayed away from the .htacess comment.

Follow the FastCGI manual setup for IIS6/5.1 from learn IIS/PHP and let us know if it works.

We can troubleshoot more after that.

cheers,
Hades666
0
 
Dave BaldwinFixer of ProblemsCommented:
Here are the instructions from PHP.net: http://www.php.net/manual/en/install.windows.iis6.php
0
 
Randy DownsOWNERCommented:
Even php.htm should return the title. I suggest adding some text & you'll see that file. As others have pointed out it needs to end in .php for dynamic information to be displayed.

IIS needs to be setup to process php. Have you installed php? http://www.php.net/manual/en/install.windows.installer.msi.php 

By default the lastest php will try to setup as FastCGI so your IIS should be set to handle it.

Hope this helps.
0
 
mitchtAuthor Commented:
Yes, I did config Fast CGI.  Here's my notes:

http://us3.php.net/manual/en/install.windows.iis6.php

fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo=1
cgi.force_redirect = 0

http://www.iis.net/download/fastcgi

x64 fast CGI installed

cscript %windir%\system32\inetsrv\fcgiconfig.js -add -section:"PHP" ^
-extension:php -path:"D:\PHP\php-cgi.exe"

cscript %windir%\system32\inetsrv\fcgiconfig.js -set -section:"PHP" ^
-EnvironmentVars:PHPRC:"D:\PHP\"

IUSR_ENGCM-SJ1-VM14

icacls D:\inetpub\wwroot\upload /grant IUSR_ENGCM-SJ1-VM14:(OI)(CI)(M)
0
 
Dave BaldwinFixer of ProblemsCommented:
Have you restarted the server?
0
 
Dave BaldwinFixer of ProblemsCommented:
Actually, have you rebooted the computer.  I've found a number of things don't seem to start working in IIS unless you do.
0
 
Randy DownsOWNERCommented:
I think you have to set IIS to work as 32 bit for php.

Go into the application pool for the website, right click, Advanced Settings, and then change Enable 32-bit Applications to true.
0
 
mitchtAuthor Commented:
I did: cscript D:\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1

Rebooted.  No joy.
0
 
Randy DownsOWNERCommented:
Can you see your test page at http://localhost/php.htm ? Or anything on localhost?
0
 
mitchtAuthor Commented:
I can see the default under construction page.

I created a php.htm page in the directory, which I can see as http://localhost/php.htm - no php code works, only html.

http://localhost/php.php returns a 404 error, but the file is there
0
 
aboo_sCommented:
Ok if the file is there then you will see it's content even if you don't have php scripting enabled!

So if you are getting 404 on this file while other files can be seen well this means you mistyped something or maybe the file is not there, i can't find any other explanation!
0
 
Brad HoweCommented:
Hi,

PHP is x86 and you are running your app in a x64 work process.

To have IIS server PHP files the extention needs to be .php. This is how FastCGI mapping works.

When troubleshooting, make Internet Explorer give a useful error message to work with. You can do this by clicking Tools | Internet Options | Advanced and then unchecking  "Show friendly HTTP error messages".

I bet you are getting the % not a vaild win32 application error.

In order to configure IIS to run in 32-bit mode you need to execute the following command :

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1


Now, if you have an HTML coded file with PHP code embedded, it will not get exectuted.

Follow the setup here.

Specifically "Manually Configure the FastCGI Extension to Work with PHP"
http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/

Windows Server 2003 SP1 enables WOW64 compatibility for 32-bit Web applications in IIS 6.0
http://support.microsoft.com/?id=895976

Cheers,
Hades666
0
 
mitchtAuthor Commented:
php.php and php.htm files are in the same dir (D:\inetpub\wwwroot).

I can type in D:\inetpub\wwwroot\php.php and see the code, so it's there.  I even mistyped it to verify that IE would display an error.  Repeated w/D:\inetpub\wwwroot\php.htm, and that displayed OK (still no php display, though)

I've configured 32 bit apps in Win 64 and FastCGI, please see my previous posts.

Arg.
0
 
Brad HoweCommented:
D:\inetpub\wwwroot\php.php is local through a browser. That is not processed through IIS.

D:\inetpub\wwwroot\php.htm is local through a browser. The browser sees htm and doesn't call the php compiler.


As mentioned above, re-run through the manual configuration. Show errors and see the true error.

Cheers,
Hades666
0
 
Randy DownsOWNERCommented:
You might want to re-install php. It clearly is not working. Likewise you could remove IIS & install it again.
0
 
mitchtAuthor Commented:
Hades666: Same thing when I call files as localhost/php.hem or localhost/php.php

Reinstall not indicated.  PHP working @ command line, it's a config issue.

Same thing if friendlr error messages turned on or off

And when I  juse enter localhost, I get the under construction page, so that should confirm the dir IS points to.
0
 
Dave BaldwinFixer of ProblemsCommented:
If you can see the 'php.htm' thru "http://localhost/php.htm" in your browser, then it is accessing the correct directory.  If the "under construction page" is yours and you put it in the same directory, same thing.  Does PHP run from the command line In that directory?

You have to have set IIS permissions in that directory to allow scripts and execute permissions to allow scripts.  This is in addition to installing the PHP handler.
0
 
aboo_sCommented:
I have this test for you to make, I'm thinking maybe something is wrong,
Please go to your root directory and alter some text in your underconstruction page
then run it through IIS server see if iti is the same page!
0
 
mitchtAuthor Commented:
All, the server is down for the wknd.  Will get back on this Monday.

Thanks for all your attention, I'll get back w/updates!
0
 
mitchtAuthor Commented:
OK, back to it.

PHP runs from the command line in D:\inetpub\wwroot

I added text the underconstruction page, and it appears

In IE, entering http://localhost/php.htm shows the html page
entering http://localhost/php.php returns a 404 error

When I roght click on the default web site, and click properties > Home Directory > Configuration, I don't see .php i nthe application extention list.  When I add d:\php\php-cgi.exe and restart IIS, it does not appear in the list when I check to see if it's still there. ???
0
 
Brad HoweCommented:
Hi, as mentioned before. The extention needs to be php.

As well both instructions davebaldwin and I provided explain what you need to do.

If the mike type is not listed IIS will never serve php coded files.

Good luck.
Hades666
0
 
mitchtAuthor Commented:
OK, let me go through your posts and verify that everything is in order:

File extension is test.php

 "Manually Configure the FastCGI Extension to Work with PHP" - verified
http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/

Server restarted
Can see underconstruction page w/modified text
.php extension in default web site configured to c:\WINDOWS\SysWOW64\inetsrv\fcgiext.dll

'Show friendly HTTP error messages checked in IE

Running php -i from command line in d:\inetpub\wwroot returns php settings



0
 
Dave BaldwinFixer of ProblemsCommented:
Now put this file in your web root as 'phpinfo.php' and access it thru the web server with your browser.  Something like "http://www.mywebserver.com/phpinfo.php" or "http://localhost/phpinfo.php".  It should show you the same info as php -i from command line but in a web page.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>PHP Check</title>
</head>
<body>
<p>PHP Check</p>
<?php phpinfo() ?>

</body>
</html>

Open in new window

0
 
aboo_sCommented:
DaveBaldwin, I think he will not see the page at all, I checked with him for this before!
What I think is that for some reason the server is blocking php files or hiding them, this could be due to a rule a ristriction or something. Anyway please try running your php.html again after adding this to your
.htaccess file:
AddType application/x-httpd-php .php .htm .html .asp
if you don't have one in your root create it.
Please just give it a shot I think it might work, and if it does we'll know how to go on from there!
0
 
mitchtAuthor Commented:
Thanks for sticking with this guys.

aboo_s, I created the htaccess file in D:\inetpub\wwroot  A copy is attached

DaveBaldwin, I then placed your html in D:\inetpub\wwroot, fired up IE, entered http://localhost/phpinfo.php, and got a 404 error.

Arg!
0
 
aboo_sCommented:
Ok, I understand,

Now I want you to please go to the following link and see the steps in there and make sure you have them all configured the right way on your server:

http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/

Although it is very strange because even if you are not configured to run php you still can see the files which in your case you do not, but since we are talking about a strange situation it won't hurt to double check that everything is in it's place!
0
 
aboo_sCommented:
Furthur more,

can you follow the 404 error in your IIS log to determine what kind exactly it is, if it is 404.3 it means
("404.3 - MIME map policy prevents this request.")
the server is restricting the file not that it doesn't see it, and if that is the case you have to go over configs again!

You can try removing all restrictions for a little whil and then run php to see it, to know what you are dealing with exacatly.
 to remove restrictions follow this thread that I copied:

"IIS6 doesn't serve unregistered MIME types to improve security. To
add new types, right-click the server(computer icon) in IIS6 mmc and
open its properties. Click MIME Types. Also, you can only allow
specific MIMEs on specific sites or vdirs - sites/vdirs' HTTP Header
tab->MIME types.

For any types don't have a definite MIME type string, you can simply
set them as the default value: application/octet-stream

Furthermore, adding (*) wildcard to disable MIME restriction on all
file types is supported but this is not a recommended action. "





0
 
Dave BaldwinFixer of ProblemsCommented:
This question has some interesting things: http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Installation/Q_26891834.html  Try:

php-cgi.exe D:\inetpub\wwwroot\php.php > D:\inetpub\wwwroot\phpinfo.html

Then see if the "phpinfo.html" shows any errors.  You can post it here to let us look at it too.
0
 
mitchtAuthor Commented:
Hmmm...

Have a look.
phpinfo.html
php-err1.png
0
 
Dave BaldwinFixer of ProblemsCommented:
In your "phpinfo()", you have the same error as in the other question.  Try what they did and see if it helps your situation.  http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Installation/Q_26891834.html
0
 
mitchtAuthor Commented:
That got rid of the 500 eror.  Attached is the html result  phpinfo.html
0
 
Dave BaldwinFixer of ProblemsCommented:
That's good.  Can you access PHP pages with your browser now or are you still getting an error from the server?
0
 
mitchtAuthor Commented:
Entering either localhost/phpinfo.php or D:\inetpub\wwwroot\phpinfo.php in IE returns a 404 error
0
 
Dave BaldwinFixer of ProblemsCommented:
"D:\inetpub\wwwroot\phpinfo.php" shouldn't work at all.  "http://localhost/php.php" should be the original file unless you have changed the name.  You have to run it thru the server for the PHP to execute if PHP is installed properly.
0
 
mitchtAuthor Commented:
I entered the code you suggested on the 15th, and stored the file as D:\inetpub\wwwroot\phpinfo.php
0
 
mitchtAuthor Commented:
excuse me d:\inetpub\wwroot
0
 
Dave BaldwinFixer of ProblemsCommented:
Ok, I didn't realize that.  So I'm still puzzled.
0
 
mitchtAuthor Commented:
OK, I got another server up, so am giving up on this.  I'll divy up points to those who were most helpful
0
 
mitchtAuthor Commented:
Never got the server up.  I got another server to due duty on this.
0
 
Dave BaldwinFixer of ProblemsCommented:
Sorry we couldn't help you more.  Sounds like you tried everything we know.  Thanks for the points.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 17
  • 13
  • 6
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now