Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 318
shahjapan Avatar asked Sep 11 '25 02:09

shahjapan


1 Answers

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
like image 105
shahjapan Avatar answered Sep 13 '25 14:09

shahjapan