php4, php5 and php CGI
APACHE2_MODULES="alias auth_basic authz_host dir log_config mime mime_magic rewrite vhost_alias actions asis auth_digest authn_alias authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_owner authz_user autoindex cache cern_meta charset_lite dav dav_fs dav_lock dbd deflate disk_cache dumpio env expires ext_filter file_cache filter headers ident imagemap include info log_forensic logio mem_cache negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http setenvif speling status unique_id userdir usertrack version"
install apache
emerge apache2
use flags for php
=dev-lang/php-4* cgi force-cgi-redirect =dev-lang/php-5* apache2
install php
emerge '=dev-lang/php-4*' '=dev-lang/php-5*'
php4 apache module [/etc/apache2/modules.d/php4-cgi.conf]
# handler for PHP 4 scripts
ScriptAlias /php4-cgi /usr/lib/php4/bin/php-cgi
Action php4-cgi /php4-cgi
#Action php4-cgi /
#AddHandler php4-cgi .php4 .php3 .php .phtml
AllowOverride None
Options None
Order allow,deny
Allow from all
php5 apache module [/etc/apache2/modules.d/70_mod_php5.conf]
# Load the module first
LoadModule php5_module modules/libphp5.so
# Set it to handle the files
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php5
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.phtml
configure php4 and php5 [/etc/conf.d/apache2 ]
APACHE2_OPTS="-D PHP4CGI -D PHP5"
optional: add handlers in [/etc/apache2/vhosts.d/00_default_vhost.conf]
AddHandler application/x-httpd-php .php .php5
RewriteCond %{REQUEST_URI} !^/php4-cgi/
install php6
emerge libtool bison flex re2c icu
wget http://snaps.php.net/php6.0-200805142030.tar.gz
tar xvf php6.0-200805142030.tar.gz cd php6.0-2
emerge –unmerge autoconf emerge '=sys-devel/autoconf-2.1
./buildconf ./configure –with-icu-dir=/usr/local/icu –with-mysql=/usr/bin –enable-force-cgi-redirect –enable-cgi make && make install
php6 apache module [/etc/apache2/modules.d/php6-cgi.conf]
# handler for PHP 6 scripts
ScriptAlias /php6-cgi /usr/local/bin/php-cgi
Action php6-cgi /php6-cgi
AddHandler php6-cgi .php6
AllowOverride None
Options None
Order allow,deny
Allow from all
optional: rewrites for php6 cgi
RewriteCond %{REQUEST_URI} !^/php6-cgi/