RE: [PHP-DB] Persistent Connections to Oracle databases
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 11 November 2004 19:11, Patrick David wrote: > My understanding of persistent connections was that using the > ociplogon function a connection would be opened to the > database and all other connections to the same database (with > the same username and password) would use the first one > previously opened, which mean I would have only 1 connection > to the database. I know this is a late response, but I haven't seen anybody point this out yet: that's 1 connection *per Apache child process*, since each process still has to have its own connection. > But in fact it is not what is happening, > every time I submit the page to the same database a new > connection is opened. Which is a little bit annoying if I > submit this one 100 times (100 connections at the end). Potentially, if you have Apache configured to run 100 children or more. If you configure it to run only 50 children, that's the maximum number of Oracle connections you will get. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Persistent Connections to Oracle databases
Hi, I'm new in PHP, but I have already written a lot of pages using Perl. Now I would to rewrite some modules of my web application in PHP but I have a problem with persistent connections to Oracle databases. My understanding of persistent connections was that using the ociplogon function a connection would be opened to the database and all other connections to the same database (with the same username and password) would use the first one previously opened, which mean I would have only 1 connection to the database. But in fact it is not what is happening, every time I submit the page to the same database a new connection is opened. Which is a little bit annoying if I submit this one 100 times (100 connections at the end). How could I manage persistent connections using ociplogon? Is there some parameters to add in the http.conf file. I use PHP5, apache 1.3.28, and for Oracle 8i and 9i. Below is one page of my application. I hope that someone will be able to help me. \n"; $objects .= "" . $results["OBJECT_NAME"][$i] . ""; $objects .= "" . $results["OBJECT_ID"][$i] . ""; $objects .= "" . $results["CREATED"][$i] . ""; $objects .= "" . $results["LAST_DDL_TIME"][$i] . ""; $objects .= "\n"; } return $objects; } ?> Web Administration Tool for ORACLE Databases http://esorclupg/backgrnd.gif"; link=darkblue alink=red> Invalid for user in Object name Object ID Created Last DDL Time Regards Patrick David - ALL-NEW Yahoo! Messenger - all new features - even more fun!
Re: [PHP-DB] Persistent Connections
According to the docs and everything I've seen with PHP and persistent connections, you don't have to close the connection since PHP will simply reuse. Joshua Hoover > Howdy--I have a question about persistent connections and their > behavior: > > Apache 1.3.2 / PHP 4.0.6 - as a module > Win2k > > I call the following function: > > odbc_pconnect("dsn", "user", "pass"); > > At the end of the script I do NOT call odbc_close($dbConn); > > I was doing some testing and ran into a: > > Maximum number of processes exceeded etc.. etc.. etc.. > > This is in relation to the persistent connections. Now the question > is, does ODBC_CLOSE really close the connection? Or another way of > asking is, does ODBC_PCONNECT look for a use an existing connection, or > does it launch another one? > > Should I close the connection and not worry about it? > Thanks > RDB -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Persistent Connections
Howdy--I have a question about persistent connections and their behavior: Apache 1.3.2 / PHP 4.0.6 - as a module Win2k I call the following function: odbc_pconnect("dsn", "user", "pass"); At the end of the script I do NOT call odbc_close($dbConn); I was doing some testing and ran into a: Maximum number of processes exceeded etc.. etc.. etc.. This is in relation to the persistent connections. Now the question is, does ODBC_CLOSE really close the connection? Or another way of asking is, does ODBC_PCONNECT look for a use an existing connection, or does it launch another one? Should I close the connection and not worry about it? Thanks RDB
[PHP-DB] Persistent connections is not persistent (MySQL)
Actually I don't know if this problem is a PHP-, an Apache- or a MySQL-issue, but in this forum probably a lot is using the same combination of servers, so probably someone has an experience to share with me. I'm running a PHP-build website (using PHP 4.0.6) and an Apache-server (1.3.20) on a Windows 2000-server. PHP is running as a Apache-module. Most of pages is password-protected using .htaccess-files. The website is connecting to a MySQL-server (3.23.41) using pconnect(). The setup of the MySQL-server is the default in regard of the max_connections-variable (set to 100). As far as I understood, the mysql_pconnect-mechanism should reuse earlier connections made by the same user. However, I can see, that very often just a reload of a page is opening a new process, and suddenly the max_connections-limit is reached: The user is getting 'Too many connections'-errors. The SQL-server is restarted and soon after the user get 'MySQL Server has gone away'-error. On more reload of the page makes a new connection. Before I decide to raise the 'max-connections'-setting, I would be nice to hear from anyone with a similar experience. Is there a better solution, for instance using mysql_connect() and mysql_close() instead of mysql_pconnect. Or is this just a wellknown problem in MySQL? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]