/etc/apache2/modules.d/70_mod_php5.conf seems to have wrong IfModule section. Module symbol of dev-lang/php-5.x are not sapi_apache2.c, its use mod_php5.c but Module symbol of dev-lang/php-4.x are spi_apache2.c Try change file/etc/apache2/modules.d/70_mod_php5.conf from dev-lang/php-5.x like this, It should failed to detect already loaded module (Warning show if we starting apache). --- # vim: ft=apache sw=4 ts=4 <IfDefine PHP5> # Load the module first <IfModule !sapi_apache2.c> LoadModule php5_module modules/libphp5.so </IfModule> # Check again (SHOW BUGS) <IfModule !sapi_apache2.c> LoadModule php5_module modules/libphp5.so </IfModule> # Set it to handle the files <IfModule mod_mime.c> AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml AddType application/x-httpd-php .php3 AddType application/x-httpd-php .php4 AddType application/x-httpd-php .php5 AddType application/x-httpd-php-source .phps </IfModule> AddDirectoryIndex index.php index.phtml </IfDefine> --- After change sapi_apache2.c to mod_php5.c --- # vim: ft=apache sw=4 ts=4 <IfDefine PHP5> # Load the module first <IfModule !mod_php5.c> LoadModule php5_module modules/libphp5.so </IfModule> # Check again (SHOULD NOT WARN) <IfModule !mod_php5.c> LoadModule php5_module modules/libphp5.so </IfModule> # Set it to handle the files <IfModule mod_mime.c> AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml AddType application/x-httpd-php .php3 AddType application/x-httpd-php .php4 AddType application/x-httpd-php .php5 AddType application/x-httpd-php-source .phps </IfModule> AddDirectoryIndex index.php index.phtml </IfDefine> --- I found this when I try to use <IfModule sapi_apache2.c> with apache configuration that use dev-lang/php5-x but It doesn't work This is some of my config that turn safe_mode off for some sites. <Directory /var/www/localhost/htdocs-secure/phpmyadmin/> <IfModule sapi_apache2.c> php_admin_flag safe_mode off php_flag display_errors On php_value max_execution_time 0 php_value memory_limit "128M" php_admin_value upload_max_filesize "128M" php_admin_value post_max_size "128M" </IfModule> </Directory> This config works with php4 but php5 doesn't work, after change to <Directory /var/www/localhost/htdocs-secure/phpmyadmin/> <IfModule mod_php5.c> php_admin_flag safe_mode off php_flag display_errors On php_value max_execution_time 0 php_value memory_limit "128M" php_admin_value upload_max_filesize "128M" php_admin_value post_max_size "128M" </IfModule> </Directory> Apache configuration are now working correctly. --- emereg --info if needed: --- sesshomaru modules.d # emerge --info Portage 2.0.54 (default-linux/x86/2005.1, gcc-3.3.6, glibc-2.3.5-r2, 2.6.15-gentoo-r1 i686) ================================================================= System uname: 2.6.15-gentoo-r1 i686 AMD Sempron(tm) 2600+ Gentoo Base System version 1.6.14 dev-lang/python: 2.3.5-r2, 2.4.2 sys-apps/sandbox: 1.2.12 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1 sys-devel/binutils: 2.16.1 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=athlon-xp -O3" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/bind /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=athlon-xp -O3" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks sandbox sfperms strict" GENTOO_MIRRORS="ftp://202.142.215.9/pub/mirrors/gentoo http://gentoo.osuosl.org" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://202.142.215.9/gentoo-portage" USE="x86 acpi alsa apache2 apm arts avi berkdb bitmap-fonts bzip2 crypt cups eds emboss encode expat foomaticdb fortran gd gdbm geoip gif gpm gstreamer gtk gtk2 imap imlib ipv6 jpeg ldap libg++ libwww mad mikmod mmx motif mp3 mpeg mysql ncurses nls nptl ogg oggvorbis opengl oss pam pcre pdflib perl perlsuid php png python quicktime readline sasl sdl snmp spell sse ssl tcpd threads truetype truetype-fonts type1-fonts udev vhosts vorbis xml xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS
Err, if you are trying to set -D PHP4 -D PHP5 in APACHE2_OPTS, then that will *never* work. If not, then post some erorrs you get, since it's been working perfectly fine for months for me and many other people.
Try it. It didn't work. I did use only -D PHP5 In my config and I'm sure to have only PHP5 Installed. dev-php/php, dev-php/php-cgi, dev-php/mod_php and <=dev-lang/php-5.0 is in /etc/portage/package.mask
I think I need to reopen this. because for >=dev-lang/php-5.0.0 file /etc/apache2/modules.d/70_mod_php.conf <IfModule mod_php5.c> should be use instead of <IfModule sapi_apache2.c> I mean use <IfModule sapi_apache2.c> directive won't work as expected with >=dev-lang/php-5.0.0
Indeed, Apache 1 and Apache 2 see mod_php5 as mod_php5.c and not apache2_sapi.c, so the checks indeed needed to be fixed. By doing this we also discovered that mod_php4 needed, for Apache 1, mod_php4.c, for Apache 2 instead apache2_sapi.c was correct in this case... PHP4 + Apache1 --> mod_php4.c PHP4 + Apache2 --> sapi_apache2.c PHP5 + Apache1 --> mod_php5.c PHP5 + Apache2 --> mod_php5.c The config files were now changed to reflect this and the fixed versions committed to CVS, emerge --sync in a couple of hours and re-emerge dev-lang/php to get the fixed versions if needed. Best regards, and thanks a lot for pointing this out, CHTEKK.