« Previous Next »

Answered Thread: problem with executing php file after installing with WPI

Last post 12-02-2009 11:20 PM by don.raman. 21 replies.

Average Rating Rate It (5)

RSS

Page 1 of 2 (22 items) 1 2 Next >

Sort Posts:

  • 11-05-2009, 2:57 AM

    problem with executing php file after installing with WPI

    PHP installed successfully with WPI. The php file run on the command prompt (cmd). However, when I try to run any php file (<?php phpinfo(); ?>) in the browser, nothing happen. It dosen't look it the my webserver is able to execute the PHP file.  If I have the php tag inside of the html, all the html stuff work, but not the php stuff.  One note to make is my webserver folder is not in the default folder. I use c:\website (rather than c:\inetpub\) to store all my asp.net, html file. So do I have to specify the path in the php.ini in order for the php file to work. Thank you in advance for your help.  Thank you

    Eric
  • 11-05-2009, 3:07 AM In reply to

    Re: problem with executing php file after installing with WPI

    Hi,

    You don't need to specify anything in your PHP.INI file. If C:\Website is physical path mapped to 'Default Web Site' which is binded to default port 80, just type http://localhost/test.php (I am assuming test.php is under C:\Website) and you should be able to display the page.

    Also try putting a ASP page underneath and see if that works or not.

    I also hope that you have saved your PHP file as plain text file and not in some other format like UNICODE. Also let me know what IIS version you are running and what OS?

    Thanks,

    Don.

  • 11-05-2009, 3:11 AM In reply to

    Re: problem with executing php file after installing with WPI

    Hi,

    If you are running IIS7 and above do:

    Run the below command:

    %WINDIR%\system32\inetsrv\appcmd.exe list config /section:fastcgi /text:*

    Also run:

    %WINDIR%\system32\inetsrv\appcmd.exe list config /section:handlers /text:* | findstr /i PHP

    And paste the output of each of these.

    If you are running XP/2k3 do:

    run both the commands below in a command window and paste the result here:

    cscript.exe C:\inetpub\AdminScripts\adsutil.vbs GET w3svc/DefaultDoc

    cscript.exe C:\inetpub\AdminScripts\adsutil.vbs GET w3svc/ScriptMaps | findstr php

    Thanks,

    Don.

  • 11-05-2009, 5:56 PM In reply to

    Re: problem with executing php file after installing with WPI

    Yes...all the asp.net and html file work in the c:\website server folder. It's set as 'Default Web Site'.  I did save php file in plain text. It's running on IIS 5.1 and Windows XP pro.

    Eric
  • 11-05-2009, 6:08 PM In reply to

    Re: problem with executing php file after installing with WPI

    It's in windows xp pro

    First command return:

    cscript.exe c:\inetpub\AdminScripts\adsutil.vbs GET w3svc/DefaultDoc

    Microsoft (R) Windows Script Host Version 5.7
    Copyright (C) Microsoft Corporation. All rights reserved.

    DefaultDoc                      : (STRING) "Default.htm,Default.asp,index.htm,index.php"

     

    cscript.exe C:\inetpub\AdminScripts\adsutil.vbs GET w3svc/ScriptMaps | findstr php

    ".php,C:\WINDOWS\system32\inetsrv\fcgiext.dll,5,GET,HEAD,POST"

     

     

    Eric
  • 11-05-2009, 6:48 PM In reply to

    Re: problem with executing php file after installing with WPI

    Hi,

    Seems like installation is fine at least from PHP point of view. Can you look at directory 'C:\WINDOWS\system32\inetsrv' and ensure that you have:

    • fcgiext.dll
    • fcgiext.ini

    Also open the fcgiext.ini file and see if you have things set properly. A properly set INI file should have:

    [Types]
    php=PHP

    [PHP]
    ExePath=C:\Program Files\PHP\php-cgi.exe
    InstanceMaxRequests=10000
    ActivityTimeout=600
    RequestTimeout=600
    EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000,PHPRC:C:\Program Files\PHP\

    Ensure that C:\Program Files\PHP\php-cgi.exe exists. and there is a valid php.ini file in the same directory.

    Can you run 'C:\Program Files\PHP\php-cgi.exe' <C:\website\test.php> and see what happens?

    Disable IE friendly HTTP error and see if you get any errors in your browser. Can you also paste the content of PHP file you are trying to run.

    Thanks,

    Don.

     

  • 11-05-2009, 7:38 PM In reply to

    Re: problem with executing php file after installing with WPI

    I see those two files (fcgiext.dll and fcgiext.ini) in the 'C:\WINDOWS\system32\inetsrv'. But I only see fcgiext not fcgiext.ini. I don't know if that make any different. I open the fcgiext and I'm do see what you had pointed out:

    [Types]
    php=PHP

    [PHP]
    ExePath=C:\Program Files\PHP\php-cgi.exe
    InstanceMaxRequests=10000
    ActivityTimeout=300
    RequestTimeout=600
    EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000,PHPRC:C:\Program Files\PHP\

    I do see C:\Program Files\PHP\php-cgi.exe there. And I do see a php.ini in the same directory. However, I don't kow if it's valide or not. So I ran the 'C:\Program Files\PHP\php-cgi.exe' <C:\website\index.php> in the cmd and here is what it return. 

    <html>
     <head>
      <title>PHP Test</title>
     </head>
     <body>
     <p>Hello World</p>
     </body>
    </html>

     Here is the content of the index.php file

    <html>
     <head>
      <title>PHP Test</title>
     </head>
     <body>
     <?php echo '<p>Hello World</p>'; ?>
     </body>
    </html>

    I don't get any error when I run the in the browser. I'm just not getting the Hello World out put. But when I run it from the cmd, it's there.

     

    Eric
  • 11-05-2009, 8:02 PM In reply to

    Re: problem with executing php file after installing with WPI

    Hi,

    Your index.php file is perfectly valid and on my XP box having a similar configuration everything works fine. Your php-cgi.exe is also working fine.

    • Send me your index.php file at don[dot]raman[at]microsoft[dot]com
    • Can you tell me how are you accessing your page in the browser please. Paste the link you are using. I would suggest assuming C:\Website is your webroot use http://localhost/index.php and see if this works.

    Thanks,

    Don.

  • 11-05-2009, 8:18 PM In reply to

    Re: problem with executing php file after installing with WPI

    Hi

    letterchair:
    I don't get any error when I run the in the browser. I'm just not getting the Hello World out put. But when I run it from the cmd, it's there.

    What do you mean by this? You must get some error. Did you make your browser to turn off displaying friendly HTTP errors?

    Thanks,

    Don.

  • 11-05-2009, 8:33 PM In reply to

    Re: problem with executing php file after installing with WPI

    I sent the php.ini file to you. I access the site by typing in this o nthe web browser. http://10.16.131.156/index.php.  The IP is behind a firewall. YOu might not be able to access it. c:\website is the "default web site' folder. I have all the html, php and .net file there.  I can't use http://localhost/ to access any of my page.  I can only see the web page by using the IP. 

    Eric
  • 11-05-2009, 8:36 PM In reply to

    Re: problem with executing php file after installing with WPI

    There is no erro when I run the index.php.  The index.php supposed to print "hello world" on the site. But I don't see anything on the site. I don't know how to turn off display friendly http errors.  Please advice.  Thank you

    Eric
  • 11-11-2009, 11:34 PM In reply to

    Re: problem with executing php file after installing with WPI

    Don. thank you for helping me all along. Do you know why I cant execute all the php file in the cmmand line (php.exe c:\<name>.php) but not in the browser? Everytime when I run the same file from the browser, it just print the actual content of the file in browser. If I have <?php phpinfo() ?> as my php file, it will show that in the browser. I save the file as ansi. Please advice.  Thank you

    Eric
  • 11-11-2009, 11:55 PM In reply to

    Re: problem with executing php file after installing with WPI

    Hi,

    Please use php-cgi.exe to run the PHP file from command line. If php-cgi.exe is able to run it and if your PHP is configured properly I cann't see a reason why it is not working in the browser.

    BTW, in order to run it from the browser you should keep the file in the webroot folder. Typically this is located for 'Default Web Site' at C:\inetpub\wwwroot. What is the address you are typing in the browser? Which browser you are using?

    Thanks,

    Don.

  • 11-12-2009, 11:47 PM In reply to

    Re: problem with executing php file after installing with WPI

    I use the php-cgi.exe to run the php file from command line and it works fine. I get the same result as using php.exe. I just can't use the browser to run the php. I assign the 'Default Web Site' to the folder name c:\website\.  I use the IP address (http://xxx.xxx.xxx.xxx/info.php).  Thank you

    Eric
  • 11-16-2009, 1:25 PM In reply to

    Re: problem with executing php file after installing with WPI

     Hi Eric.

    I share your frustration and left a comment over on http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/ regarding this issue. I have no solution for you, but since I made that post, I have poked around in IIS and found that I had  an erroneous entry in the IIS folder Web Sites -> Properties -> Home Directory -> Configuration - Mappings. One of the Application Mappings was e:\PHP\php.exe which was a remnant from trying to install PHP manually before I knew about WPI. There is a .php mapping in this area and it's E:\WINDOWS\system32\inetsrv\fcgiext.dll, which appears to be correct, according to all the documents I've read hear on the IIS board. That mapping doesn't seem to trickle down to the other child web sites though, which it seems it should. Anyway, once I got that remnant code out, my 404 error went away, but no php parsing occurred. In other words my simple "Hello World" php page executed as a blank page in the browser. I looked at "View  - Source and there was my raw <?php
    echo 'This is my first PHP program';
    ?> code. So, PHP is not parsing now or not executing.

    I'm inclined to believe there may be some left over code in the registry that's confusing things. But, that's my update so far. I'll keep you informed.

Page 1 of 2 (22 items) 1 2 Next >
Microsoft Communities