SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Your First PHP Acript (Database driven website by Kevin Yank)

    I typed the script as follows:
    ***************************************
    <html>
    <head>
    <title>Today's Date</title>
    </head>
    <body>
    <p>Today's Date (according to this web server) is
    <?php

    echo( date("1, F dS Y.") );

    ?></p>
    </body>
    </html>
    ***************************************

    I puy that file in C:\Program Files\Apache Group\Apache2\htdocs as specified in the book, and I typed in internet explorer:

    http://localhost/today.php

    Instead of the nice sentence with the date, here is what I've got as a result:

    ***************************************
    {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\f0\fs20 \par \par \par \par \par
    Today's Date (according to this web server) is\par

    \par \par \par }
    ***************************************
    MySQL and PHP seem to work fine though. What am I doing wrong?

    Thank you.

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi--
    how would you know if php is working?
    have you tried other scripts?

    What did you name your file?

    try this:

    <?php
    phpinfo(INFO_GENERAL);
    ?>

    to see if the php configuration settings are setup correctly!

    zigzig

  3. #3
    SitePoint Member
    Join Date
    Nov 2002
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    echo( date("1, F dS Y.") );

    I think your mistake was the value of '1'. It should be the letter 'l' (L for lemons). The letter 'l' and the number '1' are very similiar, so becareful with that.

    Cheers.

  4. #4
    Wibblesticks Gryff's Avatar
    Join Date
    Oct 2001
    Location
    Asgard
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats really odd...

    The PHP output isnt untill AFTER


    {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\f0\fs20 \par \par \par \par \par
    Today's Date (according to this web server)


    I suspect something is a little screwed up somewhere :-]

    Try reinstalling PHP

    PS: Your not using MySQL in that script, so dont mention it? :P
    In a world where the human mind
    can be programmed like a computer,
    at what point does the human soul end
    and the cybernetic machinery begin?

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, it was a combination of errors:
    1- The "1" should have been the letter "L" as mentioned by Susuke.
    2- PHP was not interpreted by Apache, so it was not working! (as Morganzigzig supposed)
    3- To make the whole thing work, I had yo uninstall Apache 2.0.43, and install Apache 1.3.27 !!!

    Everything is OK now. Thank you.

  6. #6
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I forgot to mention another error (which could be made by other newbies):
    When I saved the file in Wordpad, it took it as a rich text file, and I just modified the extension to php in windows explorer!!
    This should never be done of course. Again for newbies (like me!!), the way to do it is to force the php extension in the filename area, surrounding it with quotes, like this:
    "today.php"
    Then save...

  7. #7
    SitePoint Member
    Join Date
    Nov 2002
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wink Well Done!

    You know what! I have lived the very same problem two days before. Yesterday, i have tried two hours to solve. Then today, i did understand the problem. But i have seen that , you have answered your question yourself. So, well done! We are like. I wish you success in your works.


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
  •