Gentoo Linux - Installing Apache2/PHP

October 2016

As for all installation purposes under Gentoo, Portage will handle the installation of packages and managing dependencies.

Installing Apache2

  • The installation of Apache2 will start with the command:
    • emerge apache
  • To start the server:
    • # / Etc/init.d/apache2 start 
  • The configuration file for apache2 is /etc/apache2/httpd.conf

Installing PHP

  • First of all we must modify tags in the global variable USE before starting the installation. Then start executing the commands:
    • # euse -E apache2 mysql cgi pam ssl xml # emerge -av dev-lang/php
  • Once installation is complete, check that /usr/lib/php5/bin/php-cgi exists. Then restart apache:
  • # /etc/init.d/apache2 restart

Related :

This document entitled « Gentoo Linux - Installing Apache2/PHP » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.