RE: [PHP] PHP On Solaris 9 - MySQL Problem

2004-03-19 Thread trlists
On 18 Mar 2004 Cameron B. Prince wrote:

> I'm saying I can't connect to another machine running 3.x or 4.x from PHP,
> but I can connect to either via the v4.x mysql command line client that's
> installed on the webserver with PHP.

OK, I get it.  It certainly sounds like it could be a problem with the 
client libraries.  Did you build PHP on the web server or was it built 
for you?

Have you tried connecting from a different machine using PHP (to test 
if it is just the build of PHP on that one machine that's the problem)?

--
Tom

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



RE: [PHP] PHP On Solaris 9 - MySQL Problem

2004-03-18 Thread Cameron B. Prince

> > I just finished doing that on a third machine that didn't have a 
> > previous MySQL installation. I installed the same version that the 
> > webserver has. I had the same results.
> 
> I'm losing track here -- are you saying you can't connect to 
> another machine running MySQL 3.x from PHP but you can from 
> the mysql command line client?  So this behavior is verified 
> against both a MySQL 3.x and 4.x server?

I'm saying I can't connect to another machine running 3.x or 4.x from PHP,
but I can connect to either via the v4.x mysql command line client that's
installed on the webserver with PHP.
 
> If so I agree, getting the router / firewall out of your way 
> is a good idea, though why it would matter if you can open a 
> socket connection, I don't know.

I tried this too, same deal.

> > > Note that the standard MySQL extension carries this note:
> > > 
> > > This MySQL extension will not work with MySQL versions greater
> > > than 4.1.0. For that, use MySQLi. 
> > > 
> > 
> > Not sure what MySQLi is, but I had thought since the 4.x 
> mysql client 
> > worked from the console, that there was no version problem 
> because it 
> > would be using the same client libraries that PHP is using. 
> Is that not the case?
> 
> I'm not at all clear on that.  For one thing it depends if 
> the various pieces were built dynamic or static.  I would not 
> make this assumption.
> 
> I thought you said the web server had MySQL 3.23 on it -- do 
> you also have a MySQL 4 client there?

No, the webserver only has MySQL v4.x installed from a sparc binary.

I'm going to compile a new MySQL with debugging and see if that helps.

Let me know if you have any other ideas and thanks for your help.

Cameron

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



RE: [PHP] PHP On Solaris 9 - MySQL Problem

2004-03-18 Thread trlists
On 18 Mar 2004 Cameron B. Prince wrote:

> I just finished doing that on a third machine that didn't have a previous
> MySQL installation. I installed the same version that the webserver has. I
> had the same results.

I'm losing track here -- are you saying you can't connect to another 
machine running MySQL 3.x from PHP but you can from the mysql command 
line client?  So this behavior is verified against both a MySQL 3.x and 
4.x server?

If so I agree, getting the router / firewall out of your way is a good 
idea, though why it would matter if you can open a socket connection, I 
don't know.

> > Note that the standard MySQL extension carries this note:
> > 
> > This MySQL extension will not work with MySQL versions greater
> > than 4.1.0. For that, use MySQLi. 
> > 
> 
> Not sure what MySQLi is, but I had thought since the 4.x mysql client worked
> from the console, that there was no version problem because it would be
> using the same client libraries that PHP is using. Is that not the case?

I'm not at all clear on that.  For one thing it depends if the various 
pieces were built dynamic or static.  I would not make this assumption.

I thought you said the web server had MySQL 3.23 on it -- do you also 
have a MySQL 4 client there?

--
Tom

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



RE: [PHP] PHP On Solaris 9 - MySQL Problem

2004-03-18 Thread Cameron B. Prince
Hi Tom,

> 
> Ah, that's good.  Then it is just a problem of MySQL.
> 
> Have you tried accessing a remote machine running MySQL 3.2x 
> instead of 4.0?  That seems like an obvious potential culprit.

I just finished doing that on a third machine that didn't have a previous
MySQL installation. I installed the same version that the webserver has. I
had the same results.

I was also disappointed to find that the binary distribution I'm using is
not compiled with debugging support. We've also had another thought... The
webservers are load balanced with a Cisco Local Director. This piece of
equipment is between the webserver and the dbserver. So I am now going to
install the same version of MySQL on another server on the same side of the
Local Director and see if that makes a difference. If not, I plan to
recompile MySQL with debugging and continue.

This really blows and I hope I find the solution soon.

> Note that the standard MySQL extension carries this note:
> 
> This MySQL extension will not work with MySQL versions greater
> than 4.1.0. For that, use MySQLi. 
> 

Not sure what MySQLi is, but I had thought since the 4.x mysql client worked
from the console, that there was no version problem because it would be
using the same client libraries that PHP is using. Is that not the case?

Thanks,
Cameron

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



RE: [PHP] PHP On Solaris 9 - MySQL Problem

2004-03-18 Thread trlists
On 18 Mar 2004 Cameron B. Prince wrote:

> I'm sure this is good to know because it proves at least part of PHP can
> reach the other machine... Which hopefully rules out a TCP/IP problem. I'm
> going to enable debugging on the MySQL server and see if that tells me
> anything.

Ah, that's good.  Then it is just a problem of MySQL.

Have you tried accessing a remote machine running MySQL 3.2x instead of 
4.0?  That seems like an obvious potential culprit.

Note that the standard MySQL extension carries this note:

This MySQL extension will not work with MySQL versions greater
than 4.1.0. For that, use MySQLi. 

--
Tom

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



RE: [PHP] PHP On Solaris 9 - MySQL Problem

2004-03-18 Thread Cameron B. Prince
Hi Tom,

This was a good idea...

> You might try an fsockopen() to port 3306 on the dbserver and 
> see if it works.  If not, you get a reasonably descriptive error.
> 
> I just tried a couple of known servers and bogus addresses with this
> code:
> 
>  $ipaddr = "localhost";  # substitute the IP address here $fp 
> = fsockopen($ipaddr, 3306, $errno, $errstr, 5.0); 
> var_dump($fp, $errno, $errstr); if ($fp)
>   fclose($fp);
> ?>

I setup the test page and pointed to the dbserver:

IP: 192.168.1.44 
resource(2) of type (stream) int(0) string(0) "" 

I then pointed it at localhost:

IP: localhost 
resource(2) of type (stream) int(0) string(0) "" 

And then another webserver without MySQL:

IP: 192.168.1.26 
bool(false) int(146) string(18) "Connection refused" 

I'm sure this is good to know because it proves at least part of PHP can
reach the other machine... Which hopefully rules out a TCP/IP problem. I'm
going to enable debugging on the MySQL server and see if that tells me
anything.

Thanks,
Cameron

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



RE: [PHP] PHP On Solaris 9 - MySQL Problem

2004-03-17 Thread trlists
You might try an fsockopen() to port 3306 on the dbserver and see if it 
works.  If not, you get a reasonably descriptive error.

I just tried a couple of known servers and bogus addresses with this 
code:



A server listening on that port produces:

resource(4) of type (stream)
string(0) ""
NULL

One that is not produces:

Warning: fsockopen() [http://www.php.net/function.fsockopen]:
unable to connect to 192.168.1.1:3306 in d:\TEST2.PHP on line 2 
bool(false)
int(10060)
string(185) "A connection attempt failed because the connected
party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond." 

I get the same response whether I try it from CLI or within Apache.  I 
did the test on Windows but the same would work and might tell you 
something useful if run from the server.

--
Tom

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



RE: [PHP] PHP On Solaris 9 - MySQL Problem

2004-03-17 Thread Cameron B. Prince
I updated my die message on failure to connect to print the mysql_error and
mysql_errorno output:

Could not connect : Can't connect to MySQL server on '192.168.1.44' (0) -
2003

Neither is very helpful... 

ERROR code 2000 to 2999 can be found in the MySQL source code file:
`include/errmsg.h'

Example: 2003 - Can't connect to MySQL server on 'xxx.example.com' (10060)
#define CR_CONN_HOST_ERROR 2003


Any ideas on what to do next?

This works as both root and webservd (the user the webserver runs as) :

./mysql -h 192.168.1.44 -u web -p


Thanks,
Cameron


> -Original Message-
> From: Cameron B. Prince [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 17, 2004 4:55 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP On Solaris 9 - MySQL Problem
> 
> Hey guys,
> 
> I'm back again after trying many more things to solve this 
> problem. If you weren't following the previous thread with 
> Adam, I moved my site from a single development machine to 
> the production environment which consists of a separate 
> webserver and dbserver. At that point, PHP could no longer 
> connect to MySQL.
> 
> I've started up MySQL on the webserver now and PHP can connect to it.
> Something is preventing PHP from connecting to MySQL on the 
> dbserver though and I have no clue what. I've connected to it 
> via the mysql client as both root and the webserver user from 
> the webserver. I've reinstalled the MySQL libraries and 
> recompiled PHP on the webserver, but no matter what, it still 
> won't connect to the MySQL on the dbserver.
> 
> Is there some security function in PHP preventing this? 
> Safe_mode is off, but could there be something else?
> 
> Thanks,
> Cameron
> 
> --
> 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