phpapachegentoomod-php

How to configure PHP under Apache web server in GENTOO Operating System?


is there anyone who knows how to install / configure php under apache?

I have emerge php apache both. I wanted to use mod_php for apache in GENTOO OS.

php temp.php

command line runs fine, but http://localhost/temp.php is not executing on web server instead it shows the content of the php code.


Solution

  • I found a blog and I followed his instruction and it works ! I'm sharing the solution Referenced Blog

    I put these lines in /etc/make.conf:

    USE="apache2 mysql php pam ssl xml xml2 berkdb innodb jpeg png"
    

    If you want to install also phpmyadmin, then you should also add pcre session unicode:

    USE="apache2 mysql php pam ssl xml xml2 berkdb innodb jpeg png pcre session unicode"
    

    I then changed the file /etc/init.d/apache2, in order to enable public_html folders for users (corresponding to the ~ directory), setting -D USERDIR:

    APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D USERDIR
    

    Before starting mysql, you must create (once and for all) the mysql main database, and this can be done simply by running:

    /usr/bin/mysql_install_db