Yes. Ftp works perfectly, and regular http with cgi/perl connections to the same database server works perfectly. Also rendering of standard HTML works as it should. It is only when a scripted site uses PHP/Mysql the connection to the server takes forever.
What happens if you include a largish file in php? Is that also slow?
Have you tried MySQL without php? Ie a mysql dump'n'reload on the command line?
What's your memory status? (free -m) Swapping is painful....