Program Code Errors

Discussion in 'PHP' started by idz, Sep 8, 2007.

  1. idz

    idz New Member

    Joined:
    Sep 1, 2007
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    Hi Shabbir :)
    How are you?
    According to your advice,a few days back I purchased this book- "Beginning PHP5,Apache,MySQL Web Development" by E. Naramore,J.Gerner,Stolz,M.Glass,Yann Le(Wrox Publication).
    I have installed WAMP5 version(1.7.3).But after running this program code from page 34-35 of the book I get this output in my Firefox browser(latest version)-
    Code:
    <html>
    <head>
    <title>My 1st Program</title>
    </head>
    <body>
    <?php
    echo "<h1>I'm a lumberjack.</h1>";
    echo "<h2>And I'm okay.</h2>";
    ?>
    </body>
    </html>
    
    Output:-

    I'm a lumberjack."; echo "
    And I'm okay.
    "; ?>

    Why is wrong with the above code? I am getting the 'echo, '; ?' which are part of the syntax of the program, as output!!
    Also, the <h1> tag doesn't work!!!Is anything in my configuration wrong?Or is there a error in the above mentioned code?Kindly suggest me what to do to get the correct output..
    Also,I have saved the notepad files with .php extension in a folder called "myprog" in the c:\wamp\www\myprog folder.
    But when I select the files for running from Firefox browser,it doesn't run.Why i don't know...I have to type http://localhost/programname.php every time I have to run a program in the browser!!
    Or,is there a shortcut to the above?When I select File->Open File -> program name the program doesn't run.
    I have IIS installed but I have to stop these service manually every time before I start Apache Monitor & wampServer.
    Do i also need to start the apache monitor for running PHP? :rolleyes:

    I am new to PHP programming so please help me...
    Thanks in advance
     
    Last edited by a moderator: Sep 8, 2007
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I am not sure why you are getting error like that but there is something wrong in your code file that is being executed and the one you have posted it here because I get the things as expected.
     
  3. idz

    idz New Member

    Joined:
    Sep 1, 2007
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    But do i need to run the Apache Monitor everytime for running php programs in browser?
    Also,I have IIS installed in my Win XP Pro machine..should i uninstall it?
     
  4. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    You may have more than one kind of server software installed, just don't have both running at once. I'm not sure what you mean by Apache Monitor. If you want to view the pages you've created in PHP, then you need to have the server running, because that's what interprets the PHP and builds the page.

    As Shabbir mentioned, be careful to post your code correctly. Copy and paste it to avoid mistakes.
     
  5. jwshepherd

    jwshepherd New Member

    Joined:
    Aug 13, 2007
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    VP Technology Corporation
    Location:
    Texas
    Home Page:
    http://www.officialhackers.com
    Disabling IIS and setting Apache to auto start will help. Make sure your php.ini file is copied to your windows system32 folder as well.
     
  6. idz

    idz New Member

    Joined:
    Sep 1, 2007
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    But in my PHP Folder I have many php files with various extensions but none exactly with the .ini extension.There is one php configuration settings notepad file,a php Application (CLI) file,
    php Application (CGI/Fast CGI) file,php-win(CLI) file,php.ini-dist,php.ini-recommended file and 2 registry files - pws-php5cgi,pws-php5isapi.
    ...So many files with the name 'php' are there...which one to copy?? :eek:
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice