The PHP eclass and such forces a dependency on libwww (php-4.3.3-r1, libwww-5.4.0-r1 here). Libwww with MySQL support attempts to use functions in the MySQL C API that are deprecated and, in fact, no longer present in the API with newer MySQL 4.0 releases. I hadn't noticed it before because the last time I built libwww I had an old MySQL client library laying around which did provide those functions. On a fresh install, however, this is making it completely impossible to build PHP (which ignores -libwww USE flags for reasons I assume the ebuild/eclass maintainers are aware of).
The functions _are_ in the MySQL4.0 releases, as long as USE_OLD_FUNCTIONS is defined in the CFLAGS. This is taken care of in the ebuild automatically, all that is needed is running revdep-rebuild after upgrading MySQL3 -> MySQL4. From the MySQL ebuild: ewarn "If you're upgrading from MySQL-3.x, you must recompile the other" ewarn "packages on your system that link with libmysqlclient after the" ewarn "upgrade completes. To obtain such a list of packages for your" ewarn "system, you may use 'revdep-rebuild' from app-portage/gentoolkit." PHP does build and run perfectly fine with libwww and MySQL4. The 'libwww' USE flag was removed from PHP, as we need to ensure that PEAR is built, which in turn depends on the xml stuff from libwww.
Just to be clear, as Gentoo's PHP (having tried with a fresh ~x86 rsync just now) will not apparently build without libwww (which needs the deprecated functions), and as the official MySQL AB binaries are not built with the noted CFLAG, the recommended method of ensuring production-quality PHP in Gentoo is _not_ to let Gentoo/portage maintain PHP? Seems somewhat counter to the "ultimate configurability" mantra, but, alright.
Until we get the ability to require that a package is built with a given useflag (portage 2.0.50 i'm told), this will remain. As a workaround for you, build libwww with USE="-mysql". Why are you using the MySQL AB binaries anyway? What do they have they you don't have in gentoo?