Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199901

Re: [PHP3] db connections, session state From: Joey Smith (joey <email protected>)
Date: 01/23/99

OK, I'm not *SURE* about any of this,
but since Rasmus and Co. haven't
thrown in their two bits, I'll toss out some
flame-bait, merely by espousing my
ignorance. ;)

<SNIPITTY SNIP!!!>
]>|Aaron Gomez wrote:

]>|I want to use the database extensions that PHP provides.
However,
]>|my understanding is that when a web-client connects, that
equates to
]>|one database connection. Other web-client connections would
also equate
]>|to one database connection. Therefore, if I am using
Microsoft SQL
]>|server, say, for which I am only licensed for 25 connections,
how do I
]>|provide simultaneous connections to a greater number of
web-clients
]>|exceeding my 25 license limit? So, if I have 100 simultaneous
web-clients trying
]>|to get access to my website, how do I accomplish it? Do I
have to code
]>|something special? Better yet, can I maintain an application
wide
]>|database connection for all web-clients? If so how?

Ok, if I understand correctly (which is not neccesarily true),
using
pconnect would solve your problem. I know that Sybase and MS SQL
are
similar in many ways, and I use Sybase, so I'll use that as my
point of
reference.

Here is the applicable section of the php3.ini file:

[Sybase]
sybase.allow_persistent = On ; allow or prevent
persistent link
sybase.max_persistent = -1 ; maximum number of
persistent links. -1 means no limit
sybase.max_links = -1 ; maximum number
of links (persistent+non persistent). -1 means no limit
;sybase.interface_file = "/usr/local/sybase/interfaces"
sybase.min_error_severity = 10 ; minimum error
severity to display
sybase.min_message_severity = 10 ; minimum message
severity to display

If you look at the third line, you see a "max number of links".
Set this to 25, for your example.

Now, I think this is what happens. You have 25 guys running
around
talking to MS SQL and then to Apache. If Apache can't get
anyone's attention,
I believe he'll wait around (up to the script timeout limit?)
until he does.

Basically, as long as your queries aren't taking a few minutes
each, Apache
should be able to hang on long enough to get the connection he
needs. Remember
that Apache only needs the database connection for (hopefully) a
few seconds
each time. Just long enough to do the insert, selects, and
what-have-you, then
he lets that connection go back into the pool for later use.

Also, I noticed that someone mentioned that you would have to do
MS SQL thru
ODBC.

>performance bottleneck as well since you'll have to connect
through ODBC
>connections, which I hear are a good bit slower than a native
database
>connection.

I know that you can access MS SQL natively with PHP3 as though it
were
Sybase, but the exact details elude me. If you are really
desperate, email
out-of-list, and I'll give you the addr. of a guy who is running
some
MASSIVE traffic from PHP3 on a Linux box, accessing MS SQL off a
networked
NT box using the Sybase client and PHP3 commands.

HTH, and most of all, hope I'm right! (I've eaten enuf humble pie
on this
list for a lifetime! Oh, well, how else to learn?)

Joey

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3
List administrator:  zeev-list-admin <email protected>