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

Home » Imported messages » comp.lang.php » I need Help
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: I need Help [message #169722 is a reply to message #169720] Thu, 23 September 2010 21:59 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 9/23/2010 4:19 PM, Robert Hairgrove wrote:
> Jerry Stuckle wrote:
>> On 9/23/2010 1:01 PM, Robert Hairgrove wrote:
>>> Jerry Stuckle wrote:
>>>> On 9/23/2010 3:56 AM, Robert Hairgrove wrote:
>>>> > Robert Hairgrove wrote:
>>>> >> Jerry Stuckle wrote:
>>>> >>> On 9/22/2010 4:46 PM, Robert Hairgrove wrote:
>>>> >>>> Patrick Ehrmann wrote:
>>>> >>>>> mysql_close ($verbindung);
>>>> >>>>
>>>> >>>> PHP takes care of this automatically, I believe.
>>>> >>>>
>>>> >>>
>>>> >>> Never a good idea to allow PHP to close the connection. Close it
>>>> >>> yourself when you're done!
>>>> >>
>>>> >> This is true for persistent connections. However:
>>>> >>
>>>> >> http://ch2.php.net/manual/en/function.mysql-close.php
>>>> >>
>>>> >> "(...) Using mysql_close() isn't usually necessary, as non-persistent
>>>> >> open links are automatically closed at the end of the script's
>>>> >> execution. See also freeing resources."
>>>> >
>>>> > Looking at some of the user comments, it seems that PHP
>>>> > applications on
>>>> > Windows connecting via TCP might have a problem in this regard.
>>>> > However,
>>>> > if you are connecting to the DB on localhost, e.g. on a Linux server
>>>> > hosting a website, then this shouldn't be a problem.
>>>> >
>>>> > From reading the rest of the problems posted there by users, looks
>>>> > like
>>>> > it is difficult to get it right -- best to let PHP take care of it
>>>> > unless there is a compelling reason otherwise.
>>>>
>>>> Except for extremely rare instances, you shouldn't use persistent
>>>> connections in PHP. They will almost always harm performance more than
>>>> they will help.
>>>>
>>>> And whether the script will close connections when it ends or not, it
>>>> is still not a good idea to depend on the system to close it for you.
>>>> This is true with all languages and all databases.
>>>>
>>>> Good programming practices means to always clean up after yourself and
>>>> don't depend on someone else to do it.
>>>
>>> Many other popular languages such as Java, C# and C++ also have what is
>>> known as a "garbage collection". With C++, of course, you can opt out of
>>> it (or into it, depending on the platform) and handle allocations and
>>> deallocations yourself. And depending on the platform, this may or may
>>> not be a good idea.
>>>
>>> If you don't trust PHP to get it right in cases where it is documented
>>> to work correctly, then you need to file a bug report with the
>>> developers.
>>>
>>> If you STILL don't trust them to get it right, then why are you using
>>> the language at all?
>>
>> It has nothing to do with "trusting them to do it right". It has
>> everything to do with good programming practices.
>>
>> You should never hold resources longer than you need them. Sure, they
>> will be cleaned up eventually. But the question is - WHEN? On a
>> heavily used system, it may take a relatively long time.
>>
>> If you can't bother to use good programming practices such as this, I
>> would hate to see what the rest of your code looks like.
>>
>
> This has nothing to do with my code. You are saying that the PHP docs
> are wrong, that you know better, and following their advice is adamant
> to bad programming practice.
>
> So tell me this, why should I listen to you and ignore what the PHP
> documentation says? Why should anyone listen to you?
>
> *plonk*

I am saying there are a lot of things in the PHP documentation which do
not follow good programming practices, as developed by expert
programmers during over 50 years of programming. And PHP has done a lot
of stupid things over the years.

The people who wrote PHP are not experts in a lot of things. They are
just programmers. That has been shown time and time again.

But why try to talk to an idiot?

<plonk>

--
==================
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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Book problems and solution for windows 7
Next Topic: Syntax for array?
Goto Forum:
  

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

Current Time: Thu Nov 28 15:08:33 GMT 2024

Total time taken to generate the page: 0.04576 seconds