SitePoint Sponsor

User Tag List

Results 1 to 19 of 19

Thread: PHP and Apache

  1. #1
    SitePoint Member
    Join Date
    May 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP and Apache

    Hi everybody,

    I am trying to build my fist PHP+Apache site however I can't get my server to recognize any php code for example:

    <HTML>
    <HEAD>
    <TITLE>Today's Date</TITLE>
    </HEAD>
    <BODY>
    <P>Today's Date (according to this Web server) is
    <?php

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

    ?>
    </BODY>
    </HTML>

    I build APACHE with almost all default configurations and added DSO support with ./configure --enable-module=so. The web server starts fine and serves the page ok but for the php code. Can anyone please help. Thanx so much ahead of time.

  2. #2
    SitePoint Zealot Alarion's Avatar
    Join Date
    May 2001
    Location
    Virginia
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    first off, you need to install PHP. have you done that yet?
    -=Alarion=-
    Protollix - Linux hosting from $3.95/m

  3. #3
    SitePoint Member
    Join Date
    May 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sure, installed php-4.0.5 like this:
    ./configure --prefix=(my data path) --with-config-file-path=(destination path) -with-apxs=(location of apxs on my machine /usr/local/apache/bin/apsx --enable -track-vars --enable-magic-qoutes --enable-debugger
    without any problems.....

  4. #4
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What did you name the file?

    something.php ? Well if not then do that and see if it works

  5. #5
    SitePoint Member
    Join Date
    May 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it was named test.php..........thanx for you reply

  6. #6
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What exactly is happening when you call up that page?

  7. #7
    SitePoint Member
    Join Date
    May 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    all I see is the text between the <P> tags "Today's Date (according to this Web server) is" fine </P>.........

  8. #8
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does any other php code work like:

    <?php
    print "test";
    ?>

  9. #9
    SitePoint Member
    Join Date
    May 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that just prints ?>

    wierd

  10. #10
    SitePoint Member
    Join Date
    May 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually nevermind it does not show anything. i had two ?> and one was just printing

  11. #11
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like you don't have PHP installed.
    I recommend you download this file and install it, it sets up everything:

    http://www.firepages.com.au/devindex.htm

  12. #12
    SitePoint Member
    Join Date
    May 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is this only for Winx machines cause i am trying to build this on Linux

  13. #13
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just making sure, you did changed Apache's conf file to reconize and .php files and send them to PHP right?

  14. #14
    SitePoint Zealot Paul_M's Avatar
    Join Date
    Mar 2001
    Location
    London
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    remember according to the php install instructions it tells you to add a line to Apache's conf file about recognising php files...and if you follow these instructions only files with a *.php4 extension get parsed...

    Check the conf file and edit that line so that is parses *.php extensions as well!

    I hope this helps

  15. #15
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you need to add the php modules path to apaches module listing...
    i dunno...

  16. #16
    SitePoint Member
    Join Date
    May 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    kunal would you please explain how to do that...thanx in advance

  17. #17
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well.. goto the httpd.conf file.. pico it

    now.. look for the lines
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps



    they will be commented.. uncomment them.. restart apache.. this should solve the problem...
    Last edited by kunal; May 28, 2001 at 11:32.
    i dunno...

  18. #18
    SitePoint Member
    Join Date
    May 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    kunal you are king. that was it bud. i can't believe i missed that. i had manually added AddType application/x-httpd-php .php at the end of my httpd.conf but for some reason it wasn't being parsed. thanx again.

  19. #19
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool, glad i could help
    i dunno...


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
  •