Jump to content

Some help please with connections


gingerboy101

Recommended Posts

Hi all,

I am trying to get my head around what is the best, cleanest and most secure why to connect to a MySql data base.

In short I followed the Membership system tutorial, in the tutorial you create a single file 'db.php' which holds the connection. However when I check the server it is leaving the connection open in some cases for 20,000 plus second and then creates more connections etc, the problem builds to a large number of connections which I have to go and kill.

It seems when reading through various posts on the forum, that in many cases new connections are created in each page and they are also not persistent connections, so I have modified the 'db.php' to use non persistent connections and also added the mysql_close() command at the end of each page but they still seem to remain open. I have also amended the php.ini file to time connections out after 60 seconds but this has had no effect, and set the my.ini file for MySql to do the same but the same results.

Am I best therefore to as in many posts create a new connection for each page?? I hope that this make sence and I dare say that I have answered my own question but some confirmation and clartity would be very help please.

Cheers
Link to comment
https://forums.phpfreaks.com/topic/30873-some-help-please-with-connections/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.