Results 1 to 10 of 10

Thread: Cannot get php script to run properly on local machine

  1. #1
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Cannot get php script to run properly on local machine

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

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

    but if I run the following in C:

    <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 reults are the same (except Mozilla now shows the closing double quote).

    Help, please
    Cheers
    Billy

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You are accessing the page via your webserver, aren't you? It won't be parsed as PHP otherwise.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Hi Twey

    As far as I know I am. I have edited the config file for windows and added php to servers.

    Or do I have to make an explicit to something?
    Cheers
    Billy

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    How do you access the page? Describe the steps.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    I have a simple form called test.htm and processorder in inetpub/wwwroot
    <!--test.htm-->
    <form action="processorder.php" method="post">
    <table>
    <tr bgcolor="#ccccc">
    <td width="150">Item</td>
    <td width="15">Quantity</td>
    </tr>
    <tr>
    <td>Tyres</td>
    <td align="center"><input type="text" name="tireqty" size="3" maxlength="3" /></td>
    </tr>
    <tr>
    <td>Oil</td>
    <td align="center"><input type="text" name="oilqty" size="3" maxlength="3" /></td>
    </tr>
    <tr>
    <td>Plugs</td>
    <td align="center"><input type="text" name="sparkqty" size="3" maxlength="3" /></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input type="submit" value="Submit Order " /> </td>
    </tr>
    </table>
    </form>

    and processorder.php is

    <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>
    Cheers
    Billy

  6. #6
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    No,what I think Twey means is are you using a webserver. It's not enough to have PHP installed you also need a webserver such as Apache. You can't just acces the pages like you would for an html file.

  7. #7
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    I'm using IIS as the webserver.

    PHP.net provide a version which runs under IIS, which is what I've downloaded. They also have a Windows installer which is what I used to install. I read the install notes and followed the instructions there for modifying the config (php.ini) file.

    I have followed all the advised steps. I have the PHP dll (running as a cgi-exe rathe rthan ISAPI - can't remember the name off the top of my head) in the environment path.

    I've read the installation notes, checked out posts here, read the PHP and Microsoft sites and have tried to extract from them all what needs to be done and am stumped.

    Unless I've totally misunderstood all the documentation, I do not need Apache as PHP should run under IIS (which it obviously does when I run phpinfo() without a problem.
    Cheers
    Billy

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes, it seems to run fine for the phpinfo() test, but not parse the PHP for the other. Does it work if you put the "Hello" test under the same directory as the phpinfo()?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    No, I've tried that - sorry, I should have stated so originally.
    Cheers
    Billy

  10. #10
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Getting somewhere.

    If I type

    http://localhost/processorder.php

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

    Thanks to all who have tried to help.
    Cheers
    Billy

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •