diff -ru Gentoo/usr/portage/dev-lang/php/files/eblits/src_configure-v54.eblit Gentoo/usr/local/portage/dev-lang/php/files/eblits/src_configure-v54.eblit
--- Gentoo/usr/portage/dev-lang/php/files/eblits/src_configure-v54.eblit	2012-02-08 22:01:29.000000000 +0100
+++ Gentoo/usr/local/portage/dev-lang/php/files/eblits/src_configure-v54.eblit	2012-02-29 21:24:19.000000000 +0100
@@ -33,11 +33,11 @@
 	$(use_enable fileinfo fileinfo )
 	$(use_enable filter filter )
 	$(use_enable ftp ftp )
-	$(use_with nls gettext )
+	$(use_with nls gettext "${EPREFIX}"/usr)
 	$(use_with gmp gmp )
 	$(use_enable hash hash )
 	$(use_with mhash mhash )
-	$(use_with iconv iconv )
+	$(use_with iconv iconv "${EPREFIX}"/usr)
 	$(use_enable intl intl )
 	$(use_enable ipv6 ipv6 )
 	$(use_enable json json )
@@ -61,7 +61,7 @@
 	$(use_with snmp snmp )
 	$(use_enable soap soap )
 	$(use_enable sockets sockets )
-	$(use_with sqlite3 sqlite3 "${EPREFIX}"/usr)
+	$(use_with sqlite sqlite3 "${EPREFIX}"/usr)
 	$(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
 	$(use_enable sysvipc sysvmsg )
 	$(use_enable sysvipc sysvsem )
@@ -182,7 +182,7 @@
 		fi
 	    my_conf+="
 		$(use_with postgres pdo-pgsql )
-		$(use_with sqlite3 pdo-sqlite "${EPREFIX}"/usr)
+		$(use_with sqlite pdo-sqlite "${EPREFIX}"/usr)
 		$(use_with odbc pdo-odbc unixODBC,"${EPREFIX}"/usr)"
 		if use oci8-instant-client ; then
 	        my_conf+="
@@ -192,7 +192,7 @@
 
 	# readline/libedit support
 	my_conf+="
-	$(use_with readline readline )
+	$(use_with readline readline "${EPREFIX}"/usr)
 	$(use_with libedit libedit )"
 
 	# Session support
diff -ru Gentoo/usr/portage/dev-lang/php/files/eblits/src_install-v3.eblit Gentoo/usr/local/portage/dev-lang/php/files/eblits/src_install-v3.eblit
--- Gentoo/usr/portage/dev-lang/php/files/eblits/src_install-v3.eblit	2011-11-30 17:01:32.000000000 +0100
+++ Gentoo/usr/local/portage/dev-lang/php/files/eblits/src_install-v3.eblit	2012-03-01 01:28:04.000000000 +0100
@@ -40,12 +40,18 @@
 			if [[ "${sapi}" == "apache2" ]] ; then
 				# We're specifically not using emake install-sapi as libtool
 				# may cause unnecessary relink failures (see bug #351266)
-				insinto "${PHP_DESTDIR}/apache2/"
-				newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
+				insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
+
+				if [[ "$(get_libname)" == ".dylib" ]]; then
+					newins "libs/libphp5.so" "libphp${PHP_MV}.so"
+				else
+					newins "libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
+				fi
+
 				keepdir "/usr/$(get_libdir)/apache2/modules"
 			else
 				# needed each time, php_install_ini would reset it
-				into "${PHP_DESTDIR}"
+				into "${PHP_DESTDIR#${EPREFIX}}"
 			    case "$sapi" in
 					cli)
 						source="sapi/cli/php"
diff -ru Gentoo/usr/portage/dev-lang/php/php-5.4.0_rc7.ebuild Gentoo/usr/local/portage/dev-lang/php/php-5.4.0_rc7.ebuild
--- Gentoo/usr/portage/dev-lang/php/php-5.4.0_rc7.ebuild	2012-02-08 22:01:29.000000000 +0100
+++ Gentoo/usr/local/portage/dev-lang/php/php-5.4.0_rc7.ebuild	2012-02-29 21:22:30.000000000 +0100
@@ -108,7 +108,7 @@
 	mssql mysql mysqlnd mysqli nls
 	oci8-instant-client odbc pcntl pdo +phar pic +posix postgres qdbm
 	readline recode +session sharedmem
-	+simplexml snmp soap sockets spell sqlite3 ssl
+	+simplexml snmp soap sockets spell sqlite ssl
 	sybase-ct sysvipc tidy +tokenizer truetype unicode wddx
 	+xml xmlreader xmlwriter xmlrpc xpm xsl zip zlib"
 
@@ -166,7 +166,7 @@
 	snmp? ( >=net-analyzer/net-snmp-5.2 )
 	soap? ( >=dev-libs/libxml2-2.6.8 )
 	spell? ( >=app-text/aspell-0.50 )
-	sqlite3? ( >=dev-db/sqlite-3.7.6.3 )
+	sqlite? ( >=dev-db/sqlite-3.7.6.3 )
 	ssl? ( >=dev-libs/openssl-0.9.7 )
 	sybase-ct? ( dev-db/freetds )
 	tidy? ( app-text/htmltidy )
