what wrong with this PHP script ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lee Redeem

    what wrong with this PHP script ?

    Hi there

    I've created abd uploaded this basic PHP script:

    <html>
    <head>
    <title>PHP Test</title>
    </head>
    <body>
    <H1 align="center">
    <?php print("Hello world!"); ?>
    </H1>
    </body>
    </html>

    But when I go to my browser and display the page:


    it come up with the source code.

    any ideas ?

    Lee
  • Justin Koivisto

    #2
    Re: what wrong with this PHP script ?

    Lee Redeem wrote:
    [color=blue]
    > Hi there
    >
    > I've created abd uploaded this basic PHP script:
    >
    > <html>
    > <head>
    > <title>PHP Test</title>
    > </head>
    > <body>
    > <H1 align="center">
    > <?php print("Hello world!"); ?>
    > </H1>
    > </body>
    > </html>
    >
    > But when I go to my browser and display the page:
    > http://members.lycos.co.uk/eightbitfanatics/test.php
    >
    > it come up with the source code.[/color]

    Nothing's wrong with the script, it's the server. It doesn't look like
    it is set up for parsing a .php file. This means either the webmaster
    has set a different extension to be used (like .phtml) or PHP is not
    enabled on the server. I'd try to use the phtml extension if you know
    you have PHP capeabilities on the server.

    --
    Justin Koivisto - spam@koivi.com
    PHP POSTERS: Please use comp.lang.php for PHP related questions,
    alt.php* groups are not recommended.

    Comment

    • David Mackenzie

      #3
      Re: what wrong with this PHP script ?

      On Fri, 15 Aug 2003 14:07:57 GMT, Justin Koivisto <spam@koivi.com >
      wrote:
      [color=blue]
      >Lee Redeem wrote:
      >[color=green]
      >> Hi there
      >>
      >> I've created abd uploaded this basic PHP script:
      >>
      >> <html>
      >> <head>
      >> <title>PHP Test</title>
      >> </head>
      >> <body>
      >> <H1 align="center">
      >> <?php print("Hello world!"); ?>
      >> </H1>
      >> </body>
      >> </html>
      >>
      >> But when I go to my browser and display the page:
      >> http://members.lycos.co.uk/eightbitfanatics/test.php
      >>
      >> it come up with the source code.[/color]
      >
      >Nothing's wrong with the script, it's the server. It doesn't look like
      >it is set up for parsing a .php file. This means either the webmaster
      >has set a different extension to be used (like .phtml) or PHP is not
      >enabled on the server. I'd try to use the phtml extension if you know
      >you have PHP capeabilities on the server.[/color]

      It's not that. Whatever editor/method of upload the OP has used has
      converted < to &lt; and > to &gt; etc.

      If it was as simple as the server not parsing php, the <html>, <head>,
      etc would not be visible.

      I'd also suggest finding a decent host. Lycos has bloated the OP's
      original code to 13 times its size!

      --
      David (please modify address to david@ before replying!)

      Comment

      • Juha Suni

        #4
        Re: what wrong with this PHP script ?

        "Lee Redeem" <lee_news@lycos .co.uk> wrote in message
        news:888fed2a.0 308150603.4c4bf 387@posting.goo gle.com...[color=blue]
        > Hi there
        >
        > I've created abd uploaded this basic PHP script:
        >
        > <html>
        > <head>
        > <title>PHP Test</title>
        > </head>
        > <body>
        > <H1 align="center">
        > <?php print("Hello world!"); ?>
        > </H1>
        > </body>
        > </html>
        >
        > But when I go to my browser and display the page:
        > http://members.lycos.co.uk/eightbitfanatics/test.php
        >
        > it come up with the source code.[/color]

        Your server is not supporting PHP, or is not set to parse .php files by
        default. contact your server administrator.

        HTH

        --
        Suni


        Comment

        • BKDotCom

          #5
          Re: what wrong with this PHP script ?

          David Mackenzie <dcm@tarbrax.fr eeserve.co.uk> wrote in message[color=blue]
          > If it was as simple as the server not parsing php, the <html>, <head>,
          > etc would not be visible.[/color]

          ?? Where do you get that theory? True only if the server is set to
          only send files of a certain extensions or explicitly doesn't allow
          ..php files to be sent.
          you could just as well rename the script "doody.fart "... it won't get
          parsed but it will send the file as plain text.

          Comment

          • RobertMaas@YahooGroups.Com

            #6
            Re: what wrong with this PHP script ?

            {{Date: 15 Aug 2003 07:03:31 -0700
            From: lee_news@lycos. co.uk (Lee Redeem)
            But when I go to my browser and display the page:

            it come up with the source code.}}

            I clicked on that link and it seems to work fine, so I guess you found
            the problem and fixed it. What was the solution? I'm having the same
            problem with my first attempt at a php hello program:


            One possible clue is the following system message:
            2001/06/11: PHP is available. To setup for an extension in your
            site, use an .htaccess and do for example: AddHandler php4-script .php
            Is that something I need to do before my hello world script will work?
            If so, what exactly do I need to do. It's cryptic for a total beginner.
            If not, what *do* I need to do to get h.php to be processed instead of
            treated as .txt?

            For comparison, these all work:





            (First one trivial just for hack value of course, second one in a
            trivial way, no actual html in the file, but still it "works". I've
            been programming HTML since about 1995, and CGI/sh/cmucl since
            2001.Jan, but I thought I'd install a simple hello world file in each
            of those to accompany the others I'm doing in other languages I haven't
            done before, and I tried the CGI/perl one tonight for the first time
            and it worked the first time after I did the right chmod.)

            Comment

            Working...