php-general Digest 28 Apr 2008 12:00:17 -0000 Issue 5429

Topics (messages 273639 through 273647):

Re: peer review (was php framework vs just php?)
        273639 by: Jay Blanchard

mysql_connect slowness
        273640 by: Waynn Lue
        273641 by: Chris
        273645 by: Aschwin Wesselius

Re: query wildcard
        273642 by: Amit Patel
        273643 by: Amit Patel

curiosidad
        273644 by: J. Manuel Velasco - UBILIBET

SOAP and nested input
        273646 by: Emil Edeholt

PHP debugger
        273647 by: J. Manuel Velasco - UBILIBET

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
[snip]
Actually it's quite easy. I've got a similar object to the one you guys
described (can't really share it - I'm on salary so technically it
belongs to my boss.) Anyhow when I do my table layout, if there's a
look-up, I name the field "lookuptable_id" in the DB. In my object, it
looks for any field ending in "_id" (or whatever you specify to the
object - "_id" is just the default) and it creates a drop-down of the
options. 

The object also takes an array of ignore_fields, hidden_fields (good for
ID's on updates), friendlynames (you don't always want to use the
fieldname in the database, but anyhow the object replaces underscores
and capitalises), and a bunch of other customising array properties with
useful defaults. It also detects whether this is an insert or update and
knows how to route the action, and has support for file uploads (and
customises the enctype of the form for that).

So basically you can have a very nice form, customised, with one or two
lines of code to draw the form, as long as you design your object and DB
well. 
[/snip]

Cool...essentially I am extending what I showed here for the same
purpose, multiple table forms. All of the other functions must be
extended to handle the data for this, but should all be the same basic
model.



--- End Message ---
--- Begin Message ---
Our site has been slowing down dramatically in the last few days, so
I've been trying to figure out why.  I ran some profiling scripts on
our site and saw that we're spending between 3-9 seconds on
mysql_connect.  Then I connected to our db and saw that there were
over 100 connections at the time, most of them sleeping.  Is this
because we don't close mysql connections until the end of script
execution?

How do people generally structure their code to minimize the time they
keep mysql connections open?  Currently all db connections go through
one file, which gets included at the top of the file.  One other
question, is it better to open one connection, then re-use it later,
or just continually open and close per db call?

Thanks,
Waynn

--- End Message ---
--- Begin Message ---
Waynn Lue wrote:
Our site has been slowing down dramatically in the last few days, so
I've been trying to figure out why.  I ran some profiling scripts on
our site and saw that we're spending between 3-9 seconds on
mysql_connect.  Then I connected to our db and saw that there were
over 100 connections at the time, most of them sleeping.  Is this
because we don't close mysql connections until the end of script
execution?

Are you using mysql_pconnect or just mysql_connect? Persistent connections do what you outline and keep the connection sitting there. For this (and some other reasons) most people don't use persistent connections.

PHP should clean up regular _connect resources when the script(s) are finished running, you don't need to do it explicitly.

How do people generally structure their code to minimize the time they
keep mysql connections open?  Currently all db connections go through
one file, which gets included at the top of the file.  One other
question, is it better to open one connection, then re-use it later,
or just continually open and close per db call?

It'll be even slower to open/close per db call.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Waynn Lue wrote:
Our site has been slowing down dramatically in the last few days, so
I've been trying to figure out why.  I ran some profiling scripts on
our site and saw that we're spending between 3-9 seconds on
mysql_connect.  Then I connected to our db and saw that there were
over 100 connections at the time, most of them sleeping.  Is this
because we don't close mysql connections until the end of script
execution?

How do people generally structure their code to minimize the time they
keep mysql connections open?  Currently all db connections go through
one file, which gets included at the top of the file.  One other
question, is it better to open one connection, then re-use it later,
or just continually open and close per db call?

Thanks,
Waynn
Hi Waynn,

I've done some tuning on MySQL last year after having similar problems. They are not all gone, but they are reduced to a minimum.

I've read the following URL's to get some hints and tips:

www dot databasejournal dot com/features/mysql/print.php/10897_1402311_3

www dot t-scripts dot com/mysql/

mysqldatabaseadministration dot blogspot dot com/2005/11/mysql-5-optimization-and-tuning-guide.html

(I'm sorry that these URL's are not allowed due to SURBL policies, replace 'dot' with the appropiate character)

It boils down to tuning your my.cnf with some altered parameters and checking the status in MySQL. It depends on how much memory is in use, how many tables you want to have open and how many connection you expect within certain periods etc. You can gain a lot with doing this. Having sleeping processes / connections is because it doesn't have a hard timeout and MySQL sometimes forgets to kill these processes. But this is because of the load. When the load decreases, MySQL is better being able to keep up with the processes.
--

Aschwin Wesselius

'What you would like to be done to you, do that to the other....'

--- End Message ---
--- Begin Message ---
Hello All,
   I have a simple MySQL DB. What I am trying to do is let users create
reports based on date range and account type.
#1) When lets say someone selects a date range and account type = site a/c,
the query works OK and results are displayed properly.

#2) The problem I have is when someone selects a date range, and wishes to
display results of all accounts within that date range. I am not sure how
this is done. The various accounts I have are site a/c, labour a/c, salary
a/c, etc.
    When I pick a specific account_type, query works. Is there a wildcard or
any other method of doing this.

Sorry not posting code in here, since its cumbersome and long.

Thanks for ur help.

Amit.

--- End Message ---
--- Begin Message ---
Nevermind, I figured it out.

Thanks,

Amit.


On Mon, Apr 28, 2008 at 12:06 PM, Amit Patel <[EMAIL PROTECTED]> wrote:

> Hello All,
>    I have a simple MySQL DB. What I am trying to do is let users create
> reports based on date range and account type.
> #1) When lets say someone selects a date range and account type = site
> a/c, the query works OK and results are displayed properly.
>
> #2) The problem I have is when someone selects a date range, and wishes to
> display results of all accounts within that date range. I am not sure how
> this is done. The various accounts I have are site a/c, labour a/c, salary
> a/c, etc.
>     When I pick a specific account_type, query works. Is there a wildcard
> or any other method of doing this.
>
> Sorry not posting code in here, since its cumbersome and long.
>
> Thanks for ur help.
>
> Amit.
>
>

--- End Message ---
--- Begin Message ---
Hello,
Since I saw in avaaz site [http://www.avaaz.org/en/], I felt the curiosity to know how to develop a system like they use to spread the world. It is to connect to a address directory and get our contacts.

Anybody knows any library, references,... to know how to develop this service?

thanks in advance.

--- End Message ---
--- Begin Message ---
Hello!

If I need to pass nested input to a SOAP function; For example a function that requires these parameters:

<foo>bar</foo>
<foonest>
   <barnest>foobar</barnest>
</foonest>

Should I simply nest two arrays to the php soap function, i.e:
$client->foo(array("foo" => "bar", "foonest" => array("barnest" => "foobar"));

'm having some trouble with a SOAP server, and I'm not sure if I passed the params incorrectly or something else is wrong.

The exception I get is: Catchable fatal error: Object of class stdClass could not be converted to string.

Thanks for your time!

Regards Emil


--- End Message ---
--- Begin Message ---
Hello,

Anybody knows a good debugger for PHP and basic usage?

I've found: http://dd.cron.ru/dbg/, what do you think about it ?

Thanks.
--

--- End Message ---

Reply via email to