I work on website which have large number of users in php.
I wonder which is the best way to handle database connection in this case.
Every database object have it's related class and on the start of every class method database connection opens (for example GetLatestNews(), GetNewsOfType($type) etc). But I have really lot of methods so I'm afraid there should be to much connections opening.
Is it best practice in this case to open only one connection, for example in $_SESSION variable and then check if(isset($_SESSION]) or maybe to open connection on the start of every page? I know that opened connection consume server memory etc...
Can you please give me some advice from your experience?
Thanks in advance,