newbie to php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ushetgeri
    New Member
    • Sep 2009
    • 2

    newbie to php

    Hello
    I am trying this code
    Code:
    <html>
    <head>
    <title> Testing HTML </title>
    </head>
    <body>
    <h1>Hello world</h1>
    <h1><?php echo "Hello php world"; ?></h1>
    </body>
    </html>
    When I save it as htm and open in firefox I get
    Hello world
    The php code does not seem to work.
    When I view source in the browser, it shows me the same source with the php code in red.
    Apparently the server has not processed these instructions.

    When i rename it as php and open in firefox I get a prompt..
    'what do you want to open it with?
    i specify httpd.exe it does nothing
    i tried with php-win.exe same result.

    I am running windows vista

    I have edited hhtpd conf file and added load module and add type statements.

    Can you help?
    Last edited by Dormilich; Sep 7 '09, 09:38 PM. Reason: Please use [code] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    since PHP is a server side language, you have to access it through the server.* put it in the server’s root directory (or below) and call it through http://localhost/path/to/file.php.

    see also here


    * technically, you can also use the CLI, though that’s more advanced

    Comment

    • ushetgeri
      New Member
      • Sep 2009
      • 2

      #3
      Thank you. i got it working.

      Comment

      Working...