3 Votes Vote

php mysql db connect very slow

Posted by topdog 226 days ago Questions| mysql php connect All

I have a small PHP framework that basically just loads a controller and a view. An empty page loads in about 0.004 seconds, using microtime() at the beginning and end of execution.

Here's the "problem". If I do the following:

$link = @mysql_connect($server,$user,$pass,$link); @mysql_select_db($database, $link);

the page loads in about 0.500 seconds. A whopping 12500% jump in time to render the empty page.

is this normal or am I doing something seriously wrong here... (I'm hoping for the latter).

EDIT: Could someone say what a normal time penalty is for just connecting to a mysql db like above.

Discuss Bury


Who Voted for this Question