php - Why is constructing PDO connection slow? -


i'm using pdo in php application. connects mysql server on same server:

$db = new pdo(mysql:host=localhost;dbname=test, $username, $password); 

i created 2 pages same output (just dummy data in plain html) 1 of contains call create pdo. if open page uses no connection response between 0.5 , 1 second quicker.

i've been doing googling, , after reading this thread, changed localhost 127.0.0.1. solves problem....


Comments