FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » must I close mysql_connect?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: must I close mysql_connect? [message #179752 is a reply to message #179750] Mon, 03 December 2012 16:09 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 12/3/2012 9:26 AM, M. Strobel wrote:
> Am 03.12.2012 12:52, schrieb Jerry Stuckle:
>> On 12/3/2012 4:30 AM, M. Strobel wrote:
>>> Am 30.11.2012 15:15, schrieb cngrit:
>>>> In my script,I use mysql_connect to get a connection with mysql,now I want to
>>>> know,after I used it ,I must to close it, or ignore it?
>>>>
>>>> if this connection will be used many times,i need to close it after the last time,
>>>> or nothing to do?
>>>>
>>>> usually,which function you will use,mysql_connect or mysql_pconnect?
>>>>
>>> mysql_pconnect is broke, don't use it.
>>>
>>> mysql is obsolete, rather use mysqli, or even better, PDO.
>>>
>>> /Str.
>>>
>>
>> What's broke about mysql_pconnect() (other than the fact it has been deprecated)?
>> (I'm not saying he should use it - I just want to know why you claim it's broken.
>
> I experienced this once myself with a system I started to administer, the old admin
> tried to optimize with pconnect, and it brought the web site to a halt. Then I read
> somewhere it was broke, and never used it again. The only reference I have is that a
> search for "mysql_pconnect issues" yields 24000 hits, and "mysqli_pconnect issues"
> 2400. Of course most links are quite old.
>

Just because the website came to a halt doesn't mean mysql_pconnect() is
broken. There are a lot of things to consider when using persistent
connections with *any* database - not the least being the system
resources that are tied up even when there are no active connections to
the database.

Most people who try to use persistent connections have no idea what they
are doing. It takes much more than just changing mysql_connect() to
mysql_pconnect().

> Then I think the optimization achieved with pconnect is largely overestimated, and a
> risk if you use temp tables. Very often you can optimize your DB connection much more
> by using the local pipe instead of a local IP connection.
>

It can have advantages in heavily used systems (i.e. 100+ pages/sec.
using the database). But you need to know what you're doing and how to
tune the entire system.

>> Also, whether to use mysqli or pdo is a matter of choice - there are many reasons why
>> someone might want mysqli.
>
> Sure, and you can base your choice on
> http://de2.php.net/manual/en/mysqlinfo.api.choosing.php , but in a newsgroup you get
> good advice, not only technical references.
>
> /Str.
>
>

Yes, and *your opinion* is to use PDO. You should say it is only your
opinion. Others have different opinions.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Windows] php-cgi.exe can't find extension
Next Topic: when receiving the mail(php mail function), the variable's last value is getting converted to $ or # replacing the digit
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 12:23:46 GMT 2024

Total time taken to generate the page: 0.04602 seconds