Cannot get script to run properly on local machine

liunx

Guest
I've downloaded and installed php v5 on to a Windows 2000 pc with IIS as the web server. If I run the following
<?php
phpinfo();
?>

in c:\inetpub\wwwroot it returns all the configuration data.

but if I run the following:
<html>
<head>
<title>Billy's Auto Parts - Order results</title>
</head>
<body>
<h1> Billy's Auto Parts</h1>
<h2>Order results</h2>

<?php
echo '<p>order 2 processed</p>' ;
?>
</body>
</html>

the echo shows nothing in IE6 and shows

order 2 processed

' ; ?>

in Mozilla. I have tried changing <?php ?> to <script language="php"></script> but get no echo in IE6 or Mozilla.

I can't believe I'm stuck at what is essentially "hello world".

I've tried changing the single quotes after echo to doubles but the results are the same (except Mozilla now shows the closing double quote).

Help, please
__________________
Cheers
Billywell, if the phpinfo() script is working then php is working. has this file the .php extension, and is it in your c:\inetpub\wwwroot folder?Yes, its got the .php extension and I tried it in inetpub/wwwroot but no luck.

I've tried running it in Opera and I get the echo, but as with Mozilla its showing the ' ;?> as part of the echo.What do you see if you use view source? And is the code you posted an exact reproduction (a cut-and-paste) of the real code?This is an exact copy of view source in IE

<html>
<head>
<title>Billy's Auto Parts - Order results</title>
</head>
<body>
<h1> Billy's Auto Parts</h1>
<h2>Order results</h2>
<?php
echo "<p>order 2 processed</p>";
?>
</body>
</html>

I have tried Notepad and Metadata text editors with the same result.

When I upload the code to my website it works properly - here is the result

Billy's Auto Parts
Order results
order 2 processed

The webserver is Apache and uses php 4.8.9Hi Billy:
From the html source you posted:

<html>
<head>
<title>Billy's Auto Parts - Order results</title>
</head>
<body>
<h1> Billy's Auto Parts</h1>
<h2>Order results</h2>
<?php
echo "<p>order 2 processed</p>";
?>
</body>
</html>

it tells that your PHP5/IIS5/W2K setup is not working correctly, otherwise, <?php ... ?> should not appear. IE treats <?php ... ?> as an unknown tag so ignore it totally, yet Mozilla treats <?php echo "<p> as an unknown tag then sees the rest as regular characters (</p> will be considered as a tolerable error). So was the result.
Then, howcome <?php phpinfo(); ?> worked? My guess is that you might have multiple PHP instances of different versions running at that moment. If you have IIS and Apache installed on the same box, or PHP4 and PHP5 together, make sure they will not interfere each other when you do testing, cause they are all DLL's to system and system would decide when to use them and when to unload them if developers of these DLL's did not foresee every possible cases. IIS5's WWW is running in a dllhost but Apache is not. Also TCP ports issue should be taked care of for multiple web servers.

OK. Try setup PHP5 as CGI to IIS first. If it works, then try php5isapi.dll.

Hope these tips will help you out.Hi Osan

I am using all default setups such as port 80, but have edited the php.ini as advised in the installation documentation.

I do not have Apache installed and I do not have an older verion of PHP installed

The installation itself iseems not a problem or phpinfo() would not have run.

I have tried the CGI version but will try ISAPi version and see what happens

Cheers
BillyI see.
OK, tackle it from another direction: is the script file in question saved in ANSI/ASCII-DOS format? It seems that script files in Unicode format are not processed by PHP5/W2K, although they look as same as ANSI/ASCII ones in Notepad. Also sometimes script files in UTF-8 format will cause unexpected errors.I've tried saving the script as Ansi/Ascii, UTF 8 and get the same results.

If I save as Unicode or Unicide bigendian, I get a pop-up asking me if I want to open or downlaod the script.Getting somewhere.

If I type

<!-- m --><a class="postlink" href="http://localhost/processorder.php">http://localhost/processorder.php</a><!-- m -->

in the browser address box the script runs ok. I can live with this.

Thanks to all who have tried to help.

Cheers
Billy
 
Back
Top