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

shahjapan picture shahjapan · Aug 2, 2009 · Viewed 24.9k times · Source

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.

Answer

shahjapan picture shahjapan · Aug 2, 2009

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