By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,770 Members | 1,382 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,770 IT Pros & Developers. It's quick & easy.

php and mysql

P: n/a
I am trying to connect remotely to a mysql database.

here is the code:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_myDB = "http://db195.perfora.net";
$database_myDB = "dbname";
$username_myDB = "username";
$password_myDB = "password";
$myDB = mysql_pconnect($hostname_myDB, $username_myDB, $password_myDB)
or trigger_error(mysql_error(),E_USER_ERROR);
?>


here is the error:

Warning: mysql_pconnect(): Unknown MySQL Server Host 'db195.perfora.net'
(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
on line 9
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Wed, 04 May 2005 14:58:36 -0700, Kenneth <ja********@hotmail.com> wrote:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_myDB = "http://db195.perfora.net";
MySQL over HTTP? That's a new one on me. HTTP is a protocol, it wants a
hostname. Remove the http:// , unless there's some wacky new protocol tunneling
thing that's been added to MySQL that I'm not aware of.
$database_myDB = "dbname";
$username_myDB = "username";
$password_myDB = "password";
$myDB = mysql_pconnect($hostname_myDB, $username_myDB, $password_myDB)
or trigger_error(mysql_error(),E_USER_ERROR);
?>

here is the error:

Warning: mysql_pconnect(): Unknown MySQL Server Host 'db195.perfora.net'
(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
on line 9


--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

P: n/a
Kenneth <ja********@hotmail.com> wrote:
I am trying to connect remotely to a mysql database.

here is the code:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_myDB = "http://db195.perfora.net";
$database_myDB = "dbname";
$username_myDB = "username";
$password_myDB = "password";
$myDB = mysql_pconnect($hostname_myDB, $username_myDB, $password_myDB)
or trigger_error(mysql_error(),E_USER_ERROR);
?>
here is the error:

Warning: mysql_pconnect(): Unknown MySQL Server Host 'db195.perfora.net'
(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
on line 9


The error seems pretty self-explanatory to me. db195.perfora.net does not
exist. I can see that from here.

Perfora.net DOES exist. What makes you think db195.perfora.net should be
valid?
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 17 '05 #3

P: n/a
*** Andy Hassall wrote/escribió (Wed, 04 May 2005 20:19:52 +0100):
MySQL over HTTP? That's a new one on me. HTTP is a protocol, it wants a
hostname. Remove the http:// , unless there's some wacky new protocol tunneling
thing that's been added to MySQL that I'm not aware of.


SQLyog (a GUI client for Windows) has a HTTP tunneling system for MySQL
(written in PHP, by the way) but of course mysql_pconnect() doesn't know
how to handle it. I bet it's just a typo.

BTW, in my experience mysql_pconnect() is the way to kill the database
server: I used to get the max connections limit error when I had two
visitors and 98 idle open connections. I'd suggest mysql_connect() instead.

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #4

P: n/a
On Thu, 5 May 2005 13:37:55 +0200, Alvaro G Vicario
<al******************@telecomputeronline.com> wrote:
BTW, in my experience mysql_pconnect() is the way to kill the database
server: I used to get the max connections limit error when I had two
visitors and 98 idle open connections. I'd suggest mysql_connect() instead.


It depends on your configuration (e.g. number of child processes from
webserver) and number of distinct credentials used to access the database. If
your config/usage pattern doesn't match up then persistent connections in
general can easily knacker the database as you point out.

I've always thought that PHP's persistent connection system should have a
timeout where it closes connections after a while, it could piggy-back onto
requests the same way as the sessions garbage collector. It seems the only way
to do this is through your database config (if the database offers an "idle
timeout" option), or through your webserver config (e.g. MaxRequests on Apache
child processes). Seems to me it would be neater to have PHP manage its own
connection pools a bit more intelligently instead of having to configure other
tools further down the chain (which may have impact on things _other_ than PHP
that are using them).

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #5

P: n/a
>>BTW, in my experience mysql_pconnect() is the way to kill the database
server: I used to get the max connections limit error when I had two
visitors and 98 idle open connections. I'd suggest mysql_connect() instead.

It depends on your configuration (e.g. number of child processes from
webserver) and number of distinct credentials used to access the database. If
your config/usage pattern doesn't match up then persistent connections in
general can easily knacker the database as you point out.


I definitely agree.
I have a dedicated box that is running 50 websites all on one database
using p_connect. Some of the sites get a pretty intense load, but
though the caching of pages and queries there hasn't been even one
problem with a db connection yet.

Mike
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.