Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

installed php on windows but php code not interpreted? 2

Status
Not open for further replies.

Zac5

Programmer
Jan 30, 2003
75
US
Hi,

I have just installed PHP version 5 on my Windows XP machine. It was installed to C:\php. I added the simple page below in C:\Inetpub\
<HTML><HEAD><TITLE>Today's Date</TITLE></HEAD><BODY><P>Today's Date (according to this Web server) is<?php
echo( date("l, F dS Y.") );
?></BODY></HTML>

I have copied php.ini to the c:\windows\

I have amended a line in this file to show the following:
doc_root = C:\Inetpub\
I restarted IIS

however everything but the PHP bit shows. Any ideas what could be wrong please?

Thank you.
 
Did you configure IIS to know what to do with the PHP pages?


PHP.net Online Manual said:
* Under 'Home Directory', 'Virtual Directory', or 'Directory', do the following:
* Change the Execute Permissions to 'Scripts only'
* Click on the 'Configuration' button, and choose the Application Mappings tab. Click Add and set the Executable path to the appropriate CGI file. An example PHP 5 value is: C:\php\php-cgi.exe Supply .php as the extension. Leave 'Method exclusions' blank, and check the 'Script engine' checkbox. Now, click OK a few times.
* Set up the appropriate security. (This is done in Internet Service Manager), and if your NT Server uses NTFS file system, add execute rights for I_USR_ to the directory that contains php.exe / php-cgi.exe.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Hey,

The issue sounds like what Phil suggested. The mapping for .php needs to be added to IIS so that it knows how to parse files with that extension.



Brendan Murtagh - HostMySite.com
Technical Support Representative
bmurtagh@hostmysite.com
 
Hi,

I did what you have suggested but unfortunately it wasn't enough as it hasn't fixed it, I still only get the html:

"Today's Date (according to this Web server) is"

and not the php.

Still something missing unfortunately, anything further I can check or do please?
 
How are you opening the page?

You should be using the IIS webserver to call the page.

If you are opening it directly say by a double click on the file it won't work.








----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
if php were not integrated into IIS then you would see the native php code in the source code of the page. please check the SOURCE of the browsed page and report back.

if the php code is visible then you have not properly integrated php. if it is not visible then you have a problem with your php code. turn on error reporting and display_errors and restart the web-server. that should tell us what the error is. probably something in your config.

also turn on display_startup_errors() just in case there is a config dll error (such as the normal problems with the mysql lib).

if you use the php windows installer, you will NOT have the mysql libs. download these separately or install php manually from the zip file. or comment out the mysql libs in php.ini and try again.

 
Also, whenever you make a configuration change in IIS you need to re-start the service for the changes you've made to be implemented.
 
You need to add .htm (or whatever the file extension is) to the PHP handler in IIS.

You probably only have .php files configured to be handled by PHP at the moment.
 
for performance reasons i would not recommend handling all html files via php.
 
Hi,

JPADIE, I have turned on the things you mentioned and restarted IIS

Phil, I opened page through IIS this time, I have tried it with two files:

here I just get the html and not the php

here I get the following:

<p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means that a page will only be served up if the REDIRECT_STATUS CGI variable is
set, e.g. via an Apache Action directive.</p>
<p>For more information as to <i>why</i> this behaviour exists, see the <a href=" page for CGI security</a>.</p>
<p>For more information about changing this behaviour or re-enabling this webserver,
consult the installation file that came with this distribution, or visit
<a href=" manual page</a>.</p>
 
Go into the PHP.ini and turn off cgi.force_redirect

PHP.ini said:
[red]; **You CAN safely turn this off for IIS, in fact, you MUST.**[/red]
; cgi.force_redirect = 1

Remove the ; and set its value to 0.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
restarted iis, still get this:

<p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means that a page will only be served up if the REDIRECT_STATUS CGI variable is
set, e.g. via an Apache Action directive.</p>
<p>For more information as to <i>why</i> this behaviour exists, see the <a href=" page for CGI security</a>.</p>
<p>For more information about changing this behaviour or re-enabling this webserver,
consult the installation file that came with this distribution, or visit
<a href=" manual page</a>.</p>
 
From PHP.net's Bug Reports
bugs.php.net said:
[12 May 2003 11:48am UTC] bcecile at nemak dot com

I was having the same problem, and the it was related to improper NT
permissions. Please be sure that your [red]IUSR_MACHINENAME[/red] has read
permissions to the php.ini file. When I had this file in the c:\winnt
folder, only Administrators and the System accounts had read access.
This was fine while running PHP as an ISAPI module because IIS was
loading the DLL using the System account, but once I switched to a CGI
module, I started having problems. This was because IIS was now
launching the exe file as IUSR_MACHINENAME which is did not have correct
read access to the php.ini file.


Make sure the user has the proper permissions to the file.

You can do by right clicking on the file in the C:\Windows\ folder and Setting Permissions.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Hi Phil, This has got me stumped. I added IUSR but no luck. I temporarily deleted the php.ini in c:\windows to see if that had any impact, I restarted iis to see if this has any impact to the output I am getting, but there was no difference, which leads me to believe that perhaps its not eve looking at the ini file and my setup is wrong. unless you have any further suggestions, i will try and install php again.

Thanks a lot,

Zac
 
It may be looking at another php.ini file. Try doing a search for PHP.ini see how many you come up with.

If not, I guess, re-installing it would be the logical choice.

If you use the installer package from php.net it should configure it for you.









----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Glad you got it to work.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top