RE: [PHP] mysql_pconnect issue

2008-05-12 Thread Chetan Rane
Hi

The host name is localhost, username: root, and the password is blank .
If you have selected the option to allow anonymous login during installation
you can even give the user name and password dboth blank. It will log you in
as an anonymous user.

Chetan Dattaram Rane
Software Engineer
 
 
-Original Message-
From: Forcey [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 12, 2008 10:08 AM
To: Chris
Cc: bruce; php-general@lists.php.net
Subject: Re: [PHP] mysql_pconnect issue

On Mon, May 12, 2008 at 12:27 PM, Chris [EMAIL PROTECTED] wrote:
 bruce wrote:
   hi...
  
   running into a problem that i can't seem to solve...
  
   using mysql_pconnect() and i'm trying to figure out what parameters
have to
   be used in order to connect to a local mysql session, where mysql is
   accessed using the defaults (ie, no user/passwd/hostIP)

  Use 'localhost' for the host, no idea what you'd use for the user/pass,
  but mysql requires a username at least. If you're not entering one, it's
  using the username you are logged in as.

I guess the default user is 'root' and password is empty.

- forcey

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



  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql_pconnect issue

2008-05-11 Thread Chris
bruce wrote:
 hi...
 
 running into a problem that i can't seem to solve...
 
 using mysql_pconnect() and i'm trying to figure out what parameters have to
 be used in order to connect to a local mysql session, where mysql is
 accessed using the defaults (ie, no user/passwd/hostIP)

Use 'localhost' for the host, no idea what you'd use for the user/pass,
but mysql requires a username at least. If you're not entering one, it's
using the username you are logged in as.

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql_pconnect issue

2008-05-11 Thread Forcey
On Mon, May 12, 2008 at 12:27 PM, Chris [EMAIL PROTECTED] wrote:
 bruce wrote:
   hi...
  
   running into a problem that i can't seem to solve...
  
   using mysql_pconnect() and i'm trying to figure out what parameters have to
   be used in order to connect to a local mysql session, where mysql is
   accessed using the defaults (ie, no user/passwd/hostIP)

  Use 'localhost' for the host, no idea what you'd use for the user/pass,
  but mysql requires a username at least. If you're not entering one, it's
  using the username you are logged in as.

I guess the default user is 'root' and password is empty.

- forcey

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



  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql_pconnect / persistent database conections

2005-01-28 Thread Tom
Ben Edwards wrote:
Been meaning to investigate persistent database connections for a
while.  Coming from a rdbms background (oracle with a bit of whatcom
sqlanywhare) I have always felt that the overhead of opening a
connection at the beginning of each page was a little resource
intensive.
 

MySQL is not remotely the same beast as oracle - take pure session 
create times. I have a machine that runs both. Creating an oracle 
session with sqlplus command line takes in the region of 2 seconds (get 
around this for web apps by connection pooling). Creating a mysql 
connection (c client) takes in the region of 5 mS.
You also need to consider the memory / processor implications of caching 
connections (or keeping persistent connections) from your web server.

Anyway, I found mysql_pconnect and this sounds like just the ticket. 
Seems that I can just change my connect method from mysql_connect to
mysql_pconnect and it will just work.

I do have a couple of questions.  Firstly what is the story with
mysql_close.  There is no mysql_pclose.  I guess you don't need to
close the connection at the end of each page but what if you do.   Is
mysql_close ignored if the connection was made with mysql_pconnect or
douse it close the connection and next time mysql_pconnect is run it
reconnects causing no benefit over mysql_pconnect.  also what is the
timeout likely to be?
My other question is what happens if lots of people connect using the
same user/password.  I tend to do my own user management so everybody
douse.  Is doing my own user management really dodge, if we were
talking about oracle I would probably say it is.
Ben
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mysql_pconnect / persistent database conections

2005-01-28 Thread Ben Edwards
On Thu, 27 Jan 2005 22:14:52 -0800, Steve Slater
[EMAIL PROTECTED] wrote:
 At 10:43 AM 1/27/2005, Richard Lynch wrote:
 Ben Edwards wrote:
   Been meaning to investigate persistent database connections for a
   while.  Coming from a rdbms background (oracle with a bit of whatcom
   sqlanywhare) I have always felt that the overhead of opening a
   connection at the beginning of each page was a little resource
   intensive.
 
 The mysql_pconnect() function should work well to solve the wasted
 resource/overhead you describe.
 
 But you should be aware that the pconnect function does not exist
 in the mysqli set of PHP functions. The mysqli functions allow you to
 access newer features of MySQL 4.1 and higher...like prepared statements.
 
 Here is the blurb from Zend:
 
 http://www.zend.com/php5/articles/php5-mysqli.php#fn1

So basicaly they are saying that as the connection is hot closed at
the end of eatch page you will need mysql to be able to hold a lot
more open connections concurently.  I guess its something that needs
checking with the ISP of the site in question.

Ta,
ben
 
 Steve
 
 --
 Steve Slater
 [EMAIL PROTECTED]
 Information Security Training and Consulting
 
 PHP / MySQL / Web App Security (LAMP) Training:
 http://www.handsonsecurity.com/training.html
 
 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql_pconnect / persistent database conections

2005-01-27 Thread Richard Lynch
Ben Edwards wrote:
 Been meaning to investigate persistent database connections for a
 while.  Coming from a rdbms background (oracle with a bit of whatcom
 sqlanywhare) I have always felt that the overhead of opening a
 connection at the beginning of each page was a little resource
 intensive.

Pretty much is the biggest time sink on most small/medium web-sites.

 Anyway, I found mysql_pconnect and this sounds like just the ticket.
 Seems that I can just change my connect method from mysql_connect to
 mysql_pconnect and it will just work.

Yes, but...

 I do have a couple of questions.  Firstly what is the story with
 mysql_close.  There is no mysql_pclose.  I guess you don't need to
 close the connection at the end of each page but what if you do.   Is
 mysql_close ignored if the connection was made with mysql_pconnect or
 douse it close the connection and next time mysql_pconnect is run it
 reconnects causing no benefit over mysql_pconnect.  also what is the
 timeout likely to be?

mysql_close() will almost-for-sure just ignore you if you are silly enough
to close a _pconnect() opening.

Not sure which timeout you are referring to, though...

There are several timeouts you could be asking about...

You can safely assume that the default timeouts are okay for MOST sites.

 My other question is what happens if lots of people connect using the
 same user/password.  I tend to do my own user management so everybody
 douse.  Is doing my own user management really dodge, if we were
 talking about oracle I would probably say it is.

Essentially, using _pconnect() boils down to having ONE connection for
each Apache process using the same user/pass.

Or, if you have shell users, add them in as well.

Make damn sure your /etc/my.cnf setting has a limit with a few MORE
connections than your httpd.conf has for number of Apache children.

Maybe even add a comment to that effect in both places (my.cnf and
httpd.conf), so any goofball changing either configuration file knows what
not to do.

Less MySQL connections than Apache children means some Apache children
will be starved for db, and after very short time-out waiting for db, will
just puke and die on you.

Leave a few EXTRA mysql connections, so a run-away Apache/MySQL/query
problem leaves *YOU* with the ability to log in from shell with mysql
monitor or mysqladmin to diagnose/fix/kill the thing.

Otherwise, you have to bring down all of Apache to get into your database,
if you even can, with, say, a runaway MySQL query tying up the db, and
Apache patiently waiting for that and refusing to die on anything less
than kill -9 because it's busy...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql_pconnect / persistent database conections

2005-01-27 Thread Steve Slater
At 10:43 AM 1/27/2005, Richard Lynch wrote:
Ben Edwards wrote:
 Been meaning to investigate persistent database connections for a
 while.  Coming from a rdbms background (oracle with a bit of whatcom
 sqlanywhare) I have always felt that the overhead of opening a
 connection at the beginning of each page was a little resource
 intensive.
The mysql_pconnect() function should work well to solve the wasted
resource/overhead you describe.
But you should be aware that the pconnect function does not exist
in the mysqli set of PHP functions. The mysqli functions allow you to
access newer features of MySQL 4.1 and higher...like prepared statements.
Here is the blurb from Zend:
http://www.zend.com/php5/articles/php5-mysqli.php#fn1
Steve
--
Steve Slater
[EMAIL PROTECTED]
Information Security Training and Consulting
PHP / MySQL / Web App Security (LAMP) Training:
http://www.handsonsecurity.com/training.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mysql_pconnect mysql_connect

2002-01-30 Thread Jeff Sheltren

At 11:09 PM 1/2/2002 -0500, jtjohnston wrote:
What is the difference between:

$myconnection = mysql_connect($server,$user,$pass);
and
$myconnection = mysql_pconnect($server,$user,$pass);

I read the faq.

mysql_pconnect creates a persistent connection to the server... check here:
http://www.php.net/manual/en/function.mysql-pconnect.php

-Jeff



-- 
PHP General 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]




Re: [PHP] mysql_pconnect mysql_connect

2002-01-30 Thread jtjohnston

Jim,

Thanks. What I don't really get is what persistent means.

A problem I'm having with my mysql server is that it is a whole bunch of
messages with in the space of 5 minutes like:

020130 16:11:08  C:\PROGRA~1\EASYPHP\MySql\bin\mysqld.exe: Forcing close of
thread 3  user: 'root'

All I have to do is reload the same page a dozen times.

To test out the whole thing I'm replacing all my mysql_pconnect for
mysql_connect and adding mysql_close to force a closure of the connection.
Scripts just didn't seem to be closing. Hence the question. It's supposed to be
persistent only until the script finishes, but I can prove otherwise. A windows
thing? Who knows?

John


Jeff Sheltren wrote:

 At 11:09 PM 1/2/2002 -0500, jtjohnston wrote:
 What is the difference between:
 
 $myconnection = mysql_connect($server,$user,$pass);
 and
 $myconnection = mysql_pconnect($server,$user,$pass);
 
 I read the faq.

 mysql_pconnect creates a persistent connection to the server... check here:
 http://www.php.net/manual/en/function.mysql-pconnect.php

 -Jeff


-- 
PHP General 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]




Re: [PHP] mysql_pconnect mysql_connect

2002-01-30 Thread Jeff Sheltren

At 11:40 PM 1/2/2002 -0500, jtjohnston wrote:
Jim,

Thanks. What I don't really get is what persistent means.

A problem I'm having with my mysql server is that it is a whole bunch of
messages with in the space of 5 minutes like:

020130 16:11:08  C:\PROGRA~1\EASYPHP\MySql\bin\mysqld.exe: Forcing close of
thread 3  user: 'root'

All I have to do is reload the same page a dozen times.

To test out the whole thing I'm replacing all my mysql_pconnect for
mysql_connect and adding mysql_close to force a closure of the connection.
Scripts just didn't seem to be closing. Hence the question. It's supposed 
to be
persistent only until the script finishes, but I can prove otherwise. A 
windows
thing? Who knows?

John

Actually, from what I understand, with the persistent connection, it is 
left open even after the script is finished - that's why it's called 
persistent.  Read this excerpt from the link I sent you:

mysql_pconnect() acts very much like mysql_connect() with two major 
differences.
First, when connecting, the function would first try to find a (persistent) 
link that's already open with the same host, username and password. If one 
is found, an identifier for it will be returned instead of opening a new 
connection.
Second, the connection to the SQL server will not be closed when the 
execution of the script ends. Instead, the link will remain open for future 
use (mysql_close() will not close links established by mysql_pconnect()).
This type of link is therefore called 'persistent'.
Note: Note, that these kind of links only work if you are using a module 
version of PHP. See the Persistent Database Connections section for more 
information.


-Jeff (not Jim)



-- 
PHP General 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]




Re: [PHP] mysql_pconnect mysql_connect

2002-01-30 Thread jtjohnston

Actually, from what I understand, with the persistent connection, it is
left open even after the script is finished - that's why it's called
persistent.

Jeff, (Not Jim :) - it's getting way late for my tired eyes :) Sorry.

Thanks. I suppose I had to read it one more time.
That at least makes sense. I was getting errors like can't find localhost on web
pages dynamically displaying data from a db. Imagine what was happening with
multiple persistent connections jamming up my poor pentium's memory. Mysql was
freaking.
I would have to come into the office at midnight to restart the server.
When I did, I would find errors of persistent connections jamming up my memory
causing people not to be able to use pages. I simply changed mysql_pconnect for
mysql_connect and I'm ready to go home :)

A fresh restart of the server and a few tests later, I think everything is going
to be all right until the ext problem :)
John


 Thanks. What I don't really get is what persistent means.
 A problem I'm having with my mysql server is that it is a whole bunch of
 messages with in the space of 5 minutes like:
 
 020130 16:11:08  C:\PROGRA~1\EASYPHP\MySql\bin\mysqld.exe: Forcing close of
 thread 3  user: 'root'
 
 All I have to do is reload the same page a dozen times.
 
 To test out the whole thing I'm replacing all my mysql_pconnect for
 mysql_connect and adding mysql_close to force a closure of the connection.
 Scripts just didn't seem to be closing. Hence the question. It's supposed
 to be
 persistent only until the script finishes, but I can prove otherwise. A
 windows
 thing? Who knows?
 
 John

 Actually, from what I understand, with the persistent connection, it is
 left open even after the script is finished - that's why it's called
 persistent.  Read this excerpt from the link I sent you:

 mysql_pconnect() acts very much like mysql_connect() with two major
 differences.
 First, when connecting, the function would first try to find a (persistent)
 link that's already open with the same host, username and password. If one
 is found, an identifier for it will be returned instead of opening a new
 connection.
 Second, the connection to the SQL server will not be closed when the
 execution of the script ends. Instead, the link will remain open for future
 use (mysql_close() will not close links established by mysql_pconnect()).
 This type of link is therefore called 'persistent'.
 Note: Note, that these kind of links only work if you are using a module
 version of PHP. See the Persistent Database Connections section for more
 information.

 -Jeff (not Jim)




-- 
PHP General 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]




Re: [PHP] mysql_pconnect mysql_connect

2002-01-30 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then Jeff Sheltren blurted
 Actually, from what I understand, with the persistent connection, it is 
 left open even after the script is finished - that's why it's called 
 persistent.  Read this excerpt from the link I sent you:

Yes, and just to add to that I don't think I've /ever/ got worthwile
results trying to use pconnect. It just causes problems as far as I've
seen myself.

- -- 

Nick Wilson

Tel:+45 3325 0688
Fax:+45 3325 0677
Web:www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8WPKuHpvrrTa6L5oRAjNjAKCw20U9thZob/KYrYHuZlPD2arMLACffgTk
yK5kyKe5cI8SXReso0+THA0=
=Cg+U
-END PGP SIGNATURE-

-- 
PHP General 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]




Re: [PHP] mysql_pconnect to remote system

2001-10-23 Thread Andrey Hristov

The setting of the your user in Mysql is maybe to connecto only from 
localhost (their machine) if you want to connect from anywhere else you 
receive an error. Maybe this is your case. Decide : 
1)post your error message here for better solution (use mysql_error)
or
2)contact your ISP if your think that the written above is the problem.

-- 
Andrey Hristov
Web Developer
Icygen Corporation
BUILDING SOLUTIONS
http://www.icygen.com

On Tuesday 23 October 2001 03:29 am, you wrote:
 Ok, after all the problems trying to get into the flat file and stuff, i
 decided it will just be easier to use mysql... Only problem is the database
 is on the machine that is going to host the site when it's done... (Redhat
 Linux) and is being developed in my office on a windows box...

 So i need to connect to the database from my win box - and it's giving
 connection failed messages.

 This is what i'm doing:

 ?php
 $server = IP of server:3306;
 $user = username;
 $pass = password;

 if(!($myLink = mysql_pconnect($server,$user,$pass))) {
   print(Unable to connect to databasebr\n);
   exit();
 }

 ?

 and every time it gives me the error. - do i need to change the script? or
 do i need to contact the ISP that's hosting the database?

 //Nick Richardson
 [EMAIL PROTECTED]


-- 
PHP General 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]




Re: [PHP] mysql_pconnect()

2001-09-19 Thread Rasmus Lerdorf

We have gone to some trouble to provide decent documentation for PHP.

http://www.php.net/manual/en/features.persistent-connections.php

-Rasmus

On Thu, 13 Sep 2001, Christian Dechery wrote:

 what is the real advantage or use of mysql_pconnect() ??

 can I do transactions between pages or something? Cuz other than that, I
 don't see the point of having a persistent connection... performance maybe?

 _
 . Christian Dechery
 . . Gaita-L Owner / Web Developer
 . . http://www.webstyle.com.br
 . . http://www.tanamesa.com.br





-- 
PHP General 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]




Re: [PHP] mysql_pconnect()

2001-09-19 Thread Kurth Bemis

its barley decent :-)

~kurth

We have gone to some trouble to provide decent documentation for PHP.

http://www.php.net/manual/en/features.persistent-connections.php

-Rasmus

On Thu, 13 Sep 2001, Christian Dechery wrote:

  what is the real advantage or use of mysql_pconnect() ??
 
  can I do transactions between pages or something? Cuz other than that, I
  don't see the point of having a persistent connection... performance maybe?
 
  _
  . Christian Dechery
  . . Gaita-L Owner / Web Developer
  . . http://www.webstyle.com.br
  . . http://www.tanamesa.com.br
 
 
 


--
PHP General 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 General 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]




RE: [PHP] mysql_pconnect()

2001-09-19 Thread Jack Dempsey

i agree...i wish things were more like microsoft where you could search for
days and never find something, and i think bill gates should really stop
being involved closely with the development...i mean, where else can you
find that?
i wonder if he could code a hello world script in C#..

-Original Message-
From: Kurth Bemis [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 19, 2001 9:38 PM
To: Rasmus Lerdorf; Christian Dechery
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] mysql_pconnect()


its barley decent :-)

~kurth

We have gone to some trouble to provide decent documentation for PHP.

http://www.php.net/manual/en/features.persistent-connections.php

-Rasmus

On Thu, 13 Sep 2001, Christian Dechery wrote:

  what is the real advantage or use of mysql_pconnect() ??
 
  can I do transactions between pages or something? Cuz other than that, I
  don't see the point of having a persistent connection... performance
maybe?
 
  _
  . Christian Dechery
  . . Gaita-L Owner / Web Developer
  . . http://www.webstyle.com.br
  . . http://www.tanamesa.com.br
 
 
 


--
PHP General 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 General 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 General 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]




RE: [PHP] mysql_pconnect

2001-07-25 Thread Don Read


On 25-Jul-2001 Dan Goodliffe wrote:
 Just a question out of pure curiosity...
 
 If an SQL link is opened using, mysql_pconnect when does it actually close?
 

When its 'sleep' time exceeds 'wait_timeout' defined in the server
  (or possibly never on a working site).

$ mysqladmin var | grep timeout


Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General 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]