php with postgresql and threads requires libpq built with threads USE flag.
Fixed with an additional check to the PHP eclasses: php_check_pgsql() { if useq "postgres" \ && useq "apache2" && useq "threads" \ && has_version ">=dev-db/libpq-8.1.3-r1" \ && ! built_with_use ">=dev-db/libpq-8.1.3-r1" "threads" ; then eerror eerror "You must build dev-db/libpq with the 'threads' USE flag" eerror "turned on if you want to build PHP with threads support!" eerror die "Rebuild dev-db/libpq with 'threads' USE flag enabled" fi } It checks for both use "apache2" and "threads" in PHP, as only if both are enabled, PHP is compiled with thread-safety/support enabled. It also checks for the libpq version, since I've seen that only >=libpq-8.1.3-r1 has the "threads" USE flag/support. Best regards, CHTEKK.