"However, it's impossible to make any practical use of b.php without creating a work that is derived from both a.php and b.php."
The dubiousness of that proposition aside, any such combination by an end user would be explicitly legal under 17 USC 117(a). That includes _static_ linking if necessary.
"The problem is that the combination of the licenses that cover a.php and b.php don't allow this derived work under either of them."
It doesn't matter whether the licenses allow it or not. No one needs any kind of license to use something they have obtained a legitimate copy of. The only obvious way to defeat the fair use rights Congress clearly intended end users to have would be to have those who receive copies of open source software enter into valid contracts specifying otherwise.