Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.