freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: PHP, FreeTDS & Microsoft SQL Server 7, best methods?
- From: Brian Bruns <camber AT umcc.ais.org>
- To: TDS Development Group <freetds AT franklin.oit.unc.edu>
- Subject: Re: PHP, FreeTDS & Microsoft SQL Server 7, best methods?
- Date: Fri, 3 Sep 1999 09:39:48 -0400 (EDT)
On Fri, 3 Sep 1999, Rasmus Lerdorf wrote:
> > > The problem we're seeing at the moment, is despite the use of using
> > > persistant
> > > connections in our PHP/http pages, e.g. "sybase_pconnect()" - the
> > > machine
> > > running PHP/Apache quickly seems to eat up all the connections
> > > available to
> > > our Microsoft SQL Server (10 in total).
> > >
> > I'm not sure what mechanism PHP uses to cache connections, but I do know
> > that the dblib modules under PHP 3.0.x are somewhat of a mess. It looks
> > like they been worked on under 4.0.
>
> When PHP does a *_pconnect() it checks to see if a connection already
> exists with the exact same set of connection parameters. db, username,
> password, etc. This actual set is somewhat DB-dependant. If such a
> connection exists, this connection handle is returned and this function
> doesn't do anything else. This means that if you always connect to your
> DB as the same user and everything else about your pconnect is constant,
> you will eventually have the same number of persistant connections as you
> have httpd processes. Setting MaxClient in your httpd.conf will therefore
> effectively fix this number. There is also a sybase.max_links directive
> in your php3.ini file that can limit this further. But, if you have many
> more httpd processes than available connections, you lose most of the
> benefits of persistent connections.
>
> > > I've tried limiting the number of children Apache can have to only 3,
> > > this has
> > > helped a little - but it still runs out of connections.
>
> This would indicate to me that you are connecting with different
> connection parameters and thus each httpd child is maintaining multiple
> connections. One thing I asked the MySQL guys for was a way to change the
> connection parameters of an established connection on the fly. If this
> could somehow be done in FreeTDS we might be able to improve a scenario
> like this a bit. With Apache 2.0 going threaded in a hybrid manner,
> things should also improve, assuming FreeTDS is thread-safe. In the
> Apache 2.0 scenario you might configure 10 httpd processes and give each
> 10 threads. That way you would be able to handle 100 concurrent
> connections sharing 10 persistent connections.
>
Damn! I just said effectively the same thing before I read this!
> > > b) Are we using the best/most stable way of connecting PHP to a
> > > Microsoft SQL
> > > 7 server? - I'm looking to replace FreeTDS, but due to my lack of
> > > understanding of it's components, are we using the best ones?
>
> I have heard good things about Easysoft's ODBC bridge. See
> www.easysoft.com. They have PHP-specific installation instructios as
> well.
>
> > I will test PHP persistant connects this weekend and see what I can find.
> > Version information and a PHP script that replicates the problem would be
> > most helpful.
>
> Brian, I would be delighted to set you up with a CVS write account to the
> PHP code repository so you can apply whatever changes/fixes you think are
> needed. I would love to have PHP and FreeTDS working smoothly together
> and getting FreeTDS to be the primary choice for all the people out there
> that want to connect PHP to MS-SQL.
>
I'll take you up on that offer with one caveat, my time is a little short
right now and so contributions might not be coming very quickly for a
while. I realize I should expand on my comment about the state of the PHP
dblib code. It wasn't intended as a slam. The PHP dblib code sets a row
buffer of 2, then clears it with every retrieval, so using buffering is
kinda silly, although it gave me some great test code to look at for
getting row buffering working for which I am grateful.
All in all, I'd prefer to fix FreeTDS where needed instead of working
around it in PHP. But we may need to modify PHP in some ways to support
newer things that MS is doing like TDS 7.0 with multi-byte character
sets.
> -Rasmus
>
Cheers,
Brian
-
PHP, FreeTDS & Microsoft SQL Server 7, best methods?,
Karl Pielorz, 09/03/1999
- <Possible follow-up(s)>
- Re: PHP, FreeTDS & Microsoft SQL Server 7, best methods?, Karl Pielorz, 09/03/1999
- Re: PHP, FreeTDS & Microsoft SQL Server 7, best methods?, Brian Bruns, 09/03/1999
-
Re: PHP, FreeTDS & Microsoft SQL Server 7, best methods?,
Karl Pielorz, 09/03/1999
- Re: PHP, FreeTDS & Microsoft SQL Server 7, best methods?, Brian Bruns, 09/03/1999
- Re: PHP, FreeTDS & Microsoft SQL Server 7, best methods?, Rasmus Lerdorf, 09/03/1999
- Re: PHP, FreeTDS & Microsoft SQL Server 7, best methods?, Brian Bruns, 09/03/1999
- Re: PHP, FreeTDS & Microsoft SQL Server 7, best methods?, Rasmus Lerdorf, 09/03/1999
Archive powered by MHonArc 2.6.24.