Class destructor and closing non-persistent database connections

to simplify some classes I would like to use a deconstructor to close mysql connections – however if I have multiple objects php tries to close multiple connections when it only creates one. If I remove the deconstructor class, will the mysql connection automatically close at the end of the script?

I would prefer not to have to open multiple connections to the database so that I don’t get errors when closing using a deconstructor…

(a similiar post has also been posted in mysql – sorry for the duplication)

Yes, as soon as the script finishes all open connections will be closed.

Sweet. Thanks. That’s the information I had found on the web - but I just wanted to confirm it. It was also in the PHP Manual - however, some sites said it’s best practice to close the connections – even said that when ‘too many connection’ errors occur it’s because of not closing the mysql connections.

Why not aggregate the database object between the scripts that need it, then you should only have one connection to the database open between them scripts?

are you meaning use a persistent connection?