PDO closing connection

According to documentation you’re correct (http://php.net/manual/en/pdo.connections.php):

The connection remains active for the lifetime of that PDO object. To
close the connection, you need to destroy the object by ensuring that
all remaining references to it are deleted–you do this by assigning
NULL to the variable that holds the object. If you don’t do this
explicitly, PHP will automatically close the connection when your
script ends
.

Note that if you initialise the PDO object as a persistent connection it will not automatically close the connection.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)