For some reason, this info wasn’t available in one neat place. Assuming you’ve already got Gentoo running and need an Apache + PHP setup, here are the steps to follow.


  1. nano /etc/make.conf to make sure that you’ve got apache2 and php in there. PEAR seems to want xml as well, but forces it.
  2. emerge -u apache php
  3. etc-update and you should be okay on automatic
  4. add the “-D PHP4″ to your /etc/init.d/apache2 script
  5. add these lines to /etc/apache2/conf/apache2.conf:

    LoadModule php4_module extramodules/libphp4.so
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

  6. restart apache and you should be able to hit a PHP test page.

Related posts:

  1. Installing PHP4 under Apache for Windows
  2. Resin on Gentoo