troubleshooting Question

How to accelerate PHP-mysql persistent connection?

Avatar of star6868
star6868 asked on
PHP
2 Comments1 Solution748 ViewsLast Modified:
My server IP is '11.0.0.17' (local), with APACHE, PHP, MYSQL

I use following php script for mysql connection:

<?php
//$link = mysql_connect('localhost', 'test', 'password');
$link = mysql_connect('11.0.0.17', 'test', 'password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

?>

I use mysql_connect, with real IP, prepare for Remote connection, but it seem slow
- If I use command: $link = mysql_connect('localhost', 'test', 'password'); ---> connect very fast, complete immediately!
- But when I use command: $link = mysql_connect('11.0.0.17', 'test', 'password'); ---> connection completed in about 5 seconds. --> very SLOW. (Press F5 to refresh is also slow!)

I also use mysql_pconnect to replace, but it's the same!
How to make connection faster with real IP ?
ASKER CERTIFIED SOLUTION
star6868

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros