TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-19-2007, 04:50 PM   #1 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default mysql_connect VS. mysql_pconnect

mysql_connect VS. mysql_pconnect
Well, this should say enough. Which is better? I use pconnect AND connect in the same function. You can define to use it in my inc.connect.php function. Simply set TRUE to use it.

Now the question is, is it safer, faster, smarter, lighter... what is the advantage for real? If you guys can tell me, thanks. :)

Mark
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 12-19-2007, 04:51 PM   #2 (permalink)
Nor
The Addict
 
Join Date: Nov 2007
Posts: 282
Thanks: 61
Nor is on a distinguished road
Default

Yeah I'd like to know this also, because I've never used it and people are starting to use it.
__________________
PHP/XHTML Freelancer:
Cleanscript.com v3 - Programming starting at just $5 act now!
Nor is offline  
Reply With Quote
Old 12-19-2007, 06:37 PM   #3 (permalink)
The Acquainted
 
sjaq's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 113
Thanks: 11
sjaq is on a distinguished road
Default

From the php site:
Quote:
Persistent connections are links that do not close when the execution of your script ends. When a persistent connection is requested, PHP checks if there's already an identical persistent connection (that remained open from earlier) - and if it exists, it uses it. If it does not exist, it creates the link. An 'identical' connection is a connection that was opened to the same host, with the same username and the same password (where applicable).

[....]

If persistent connections don't have any added functionality, what are they good for?

The answer here is extremely simple -- efficiency. Persistent connections are good if the overhead to create a link to your SQL server is high. Whether or not this overhead is really high depends on many factors.
There are some pre's and cons about persistent connections, you just have to read it for yourself
sjaq is offline  
Reply With Quote
The Following User Says Thank You to sjaq For This Useful Post:
SOCK (12-21-2007)
Old 12-20-2007, 03:42 PM   #4 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

I know enough, thanks!
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 12-22-2007, 01:52 PM   #5 (permalink)
The Contributor
Upcoming Programmer 
 
Matt83's Avatar
 
Join Date: Oct 2007
Location: Argentina
Posts: 72
Thanks: 18
Matt83 is on a distinguished road
Default

"The mysql_pconnect() function was designed to provide a mechanism for reducing the cost of establishing and closing connections to the MySQL server. Unfortunately, due to an interaction between the architecture of the Apache server and the architecture of PHP, high traffic on a site that used pconnects could quickly clog up the MySQL server with many unused connections that could prevent many of the active connections from accessing the database." Zak Greant
__________________
http://www.mattvarone.com
Matt83 is offline  
Reply With Quote
Old 12-31-2007, 11:25 PM   #6 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

i think pconnect is better for big soks
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:13 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design