Professional Web Applications Themes

how to enable PHP on Apache? - FreeBSD

Hi all, I did a "make install clean" to compile and install phpmyadmin, which installed PHP4 as well. Then I added these lines into my httpd.conf: --------------------------------------------------------------------- .... LoadModule php4_module libexec/apache/libphp4.so .... AddModule mod_php4.c .... <IfModule mod_dir.c> <IfModule mod_php3.c> <IfModule mod_php4.c> DirectoryIndex index.php index.php3 index.html </IfModule> <IfModule !mod_php4.c> DirectoryIndex index.php3 index.html </IfModule> </IfModule> <IfModule !mod_php3.c> <IfModule mod_php4.c> DirectoryIndex index.php index.html </IfModule> <IfModule !mod_php4.c> DirectoryIndex index.html </IfModule> </IfModule> </IfModule> .... <IfModule mod_php3.c> AddType application/x-httpd-php3 .php3 AddType application/x-httpd-php3-source .php3s </IfModule> <IfModule mod_php4.c> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule> .... Alias /phpmyadmin /usr/local/www/phpMyAdmin .... --------------------------------------------------------------------- But when I now point my browser ...

  1. #1

    Default how to enable PHP on Apache?

    Hi all,

    I did a "make install clean" to compile and install phpmyadmin, which
    installed PHP4 as well. Then I added these lines into my httpd.conf:

    ---------------------------------------------------------------------
    ....
    LoadModule php4_module libexec/apache/libphp4.so
    ....
    AddModule mod_php4.c
    ....
    <IfModule mod_dir.c>
    <IfModule mod_php3.c>
    <IfModule mod_php4.c>
    DirectoryIndex index.php index.php3 index.html
    </IfModule>
    <IfModule !mod_php4.c>
    DirectoryIndex index.php3 index.html
    </IfModule>
    </IfModule>
    <IfModule !mod_php3.c>
    <IfModule mod_php4.c>
    DirectoryIndex index.php index.html
    </IfModule>
    <IfModule !mod_php4.c>
    DirectoryIndex index.html
    </IfModule>
    </IfModule>
    </IfModule>
    ....
    <IfModule mod_php3.c>
    AddType application/x-httpd-php3 .php3
    AddType application/x-httpd-php3-source .php3s
    </IfModule>
    <IfModule mod_php4.c>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    </IfModule>
    ....
    Alias /phpmyadmin /usr/local/www/phpMyAdmin
    ....
    ---------------------------------------------------------------------

    But when I now point my browser to <domain>/phpmyadmin, Firefox tells me,
    it wants to download a PHTML file. And when I point it to
    <domain>/phpmyadmin/index.php, I get a .php file, which Firefox wants to
    download as well.

    So, how can I setup Apache/PHP to interpret my php files, instead of
    sending them 1:1 to the client? Do I miss a configuration here (see
    above)?

    Greetings and TIA, Matthias

    --
    And thank you most of all for nuclear power, which is yet to cause a
    single proven fatality, at least in this country.

    -- Homer Simpson
    Oh Brother, Where Art Thou?
    Matthias Guest

  2. #2

    Default Re: how to enable PHP on Apache?

    Hello ! :-)

    You just need to install mod_php port. It's located into
    /usr/ports/www (there are a mod_php4/ and a mod_php5/ directories).
    Just "make install clean" from one or two of these directories and it
    must be installed. Because I think it's not installed (even if it's
    mentionned in httpd.conf... it's strange by the way :-).

    Don't forget to make a "/usr/local/sbin/apachectl restart" after (if
    it's not already done from the port's installation).

    Best regards,

    YLB.
    net


    On Apr 7, 2005 9:41 AM, Matthias F. Brandstetter <at> wrote: 
    Yoann Guest

  3. #3

    Default Re: how to enable PHP on Apache?

    ---------- quoting Yoann Le Bihan ---------- 

    I did all you said, httpd-error.conf says: "Apache/1.3.33 (Unix)
    mod_perl/1.29 PHP/4.3.11 configured -- resuming normal operations"

    But when I try to access my phpmyadmin installation Firefox asks me which
    program I want to use to open this PHP file :(

    Any other ideas?
    I am somewhat lost here :(

    Greetings and TIA, Matthias

    --
    See you in hell, candy boys!!

    -- Homer Simpson
    Homer Badman
    Matthias Guest

  4. #4

    Default Re: how to enable PHP on Apache?

    ---------- quoting Matthias F. Brandstetter ---------- 

    Sorry for answering to my own post, but I think I found the problem: I have
    RT installed on the same system, using mod_perl. When I disable startup of
    mod_perl, I can access phpmyadmin. So the problem only happens when I use
    mod_perl with my config.

    I tried it with

    <Location /phpmyadmin>
    SetHandler default-handler
    </Location>
    Alias /phpmyadmin /usr/local/www/phpMyAdmin

    but still have this problem :(
    Any ideas?

    --
    You know something, folks, as ridiculous as this sounds, I would rather
    feel the sweet breath of my beautiful wife on the back of my neck as I
    sleep than stuff dollar bills into some stranger's G-string.

    -- Homer Simpson
    Homer's Night Out
    Matthias Guest

  5. #5

    Default Re: how to enable PHP on Apache?

    Matthias F. Brandstetter wrote:
     
    >
    >I did all you said, httpd-error.conf says: "Apache/1.3.33 (Unix)
    >mod_perl/1.29 PHP/4.3.11 configured -- resuming normal operations"
    >
    >But when I try to access my phpmyadmin installation Firefox asks me which
    >program I want to use to open this PHP file :(
    >
    >Any other ideas?
    >I am somewhat lost here :(
    >
    >Greetings and TIA, Matthias
    >
    >[/ref]

    If you create a "normal" PHP page* under the Apache server's
    docroot (instead of in the phpmyadmin install, which is an
    alias), do you get the same behavior?

    Kevin Kinsey


    * like this:

    <?php

    // test.php --- our test of the PHP interpreter...

    echo "Hello, Matthias! I'm Php-enabled!";

    ?>
    Kevin Guest

  6. #6

    Default Re: how to enable PHP on Apache?



    It sounds like you've not got any mime types set in httpd.confg. You want to
    add something like

    AddType application/x-httpd-php .php .php4 .php3

    See if that helps

    --


    Julie
    CoreVPS Director
    CoreVPS.com - Root Access FreeBSD and Linux servers from $7.99/mo
    Julie Guest

Similar Threads

  1. Replies: 0
    Last Post: November 14th, 05:21 PM
  2. Replies: 2
    Last Post: September 27th, 12:26 PM
  3. Replies: 0
    Last Post: August 4th, 05:44 PM
  4. Replies: 0
    Last Post: July 29th, 11:44 AM
  5. Replies: 2
    Last Post: July 27th, 05:29 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139