Sunday, September 21, 2014

Integrate PHP and Apache2 in Gentoo by emerge

My experience to integrate PHP and apache in Gentoo by emerge

It is an easy way to install PHP in gentoo by "emerge --ask php", but it will not integrate PHP and Apache.

My solution is

in /etc/portage/package.use, add
dev-lang/php apache2

lets again "emerge --ask php",

The following USE changes are necessary to proceed:
#required by dev-lang/php-5.6.0, required by php (argument)
>=app-admin/eselect-php-0.7.1-r3 apache2

Use --autounmask-write to write changes to config files (honoring CONFIG_PROTECT).

The error is like to ask to install an external application, so the final solution is

in /etc/portage/package.usage, add
dev-lang/php apache2
>=app-admin/eselect-php-0.7.1-r3 apache2

So the result of "emerge --ask php" is like

localhost ~ # ls -l /usr/lib/apache2/modules/
total 1204
lrwxrwxrwx 1 root root     31 Sep 21 16:16 libphp5.so -> ../../php5.5/apache2/libphp5.so

in /etc/conf.d/apache2
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"

Finally,
/etc/init.d/apache2 restart

No comments: