I have a new VPS server, and I'm trying to get it to connect to another server at the same ISP. When I connect via mysql's command line tool, the connection is very fast.
When I use PHP to connect to the remote DB, the connection time may take up to 5 seconds. Queries after this are executed quickly.
This is not limited to mysql, using file_get_contents() to download a file from nearly any other server gives the same lag. Using wget to get the file does not have this lag.
I timed DNS queries from within PHP using dns_get_record(), and these are fast (1-2 milliseconds).
Any thoughts on what in the php config may be causing this?
Thanks.