Any MySQL / PHP4 experts?

Posted by: rob

Any MySQL / PHP4 experts? - 04/12/2004 19:17

I've been trying to install a PHP application (XPWeb) on an Apache2 box for some hours. The app fails to run, and I've tracked it down to this function:

	function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
if (ADODB_PHPVER >= 0x4300)
{
// This next function never returns
$this->_connectionID = mysql_pconnect($argHostname,$argUsername,$argPassword,$this->clientFlags);
echo("This never gets called");
}
else
$this->_connectionID = mysql_pconnect($argHostname,$argUsername,$argPassword);

if ($this->_connectionID === false) return false;
if ($this->autoRollback) $this->RollbackTrans();
if ($argDatabasename) return $this->SelectDB($argDatabasename);

return true;
}


The comments are mine. The mysql_pconnect() function enters but never returns. No error is generated, and nothing shows up in the PHP, Apache or MySQL logs. The data passed in to the function looks good, and I can connect to MySQL manually without a problem.

Is there something wierd with MySQL and PHP4 on Debian that I should know about?

Rob
Posted by: drakino

Re: Any MySQL / PHP4 experts? - 04/12/2004 21:51

Random shot in the dark, is PHP safe mode enabled? What happens when it is disabled?
Posted by: rob

Re: Any MySQL / PHP4 experts? - 04/12/2004 22:16

Nope, disabled.

Rob
Posted by: Shonky

Re: Any MySQL / PHP4 experts? - 04/12/2004 23:26

What is the pconnect function called with as arguments? i.e. what are:

$argHostname,
$argUsername,
$argPassword,
$this->clientFlags
Posted by: jimhogan

Re: Any MySQL / PHP4 experts? - 04/12/2004 23:53

Quote:
else
$this->_connectionID mysql_pconnect($argHostname,$argUsername,$argPassword);

Any change if you explicitly bound the else action with curly braces (or maybe that's a typo?)? I have been working with PHP lately, but don't have a good sense of how strict it is.

This is interest to me as I am just starting to dig into AODB. I am assuming PHP version > 4.3 and that you are using same args to connect to DB manually.
Posted by: rob

Re: Any MySQL / PHP4 experts? - 05/12/2004 00:07

Quote:
What is the pconnect function called with as arguments?

I traced them out - all strings are valid (and the flags are optional, removing that arg makes no difference). In any case the first time this is called there is no database, but the function should still return (a failure). I made a database manually and that didn't help either.

Rob
Posted by: rob

Re: Any MySQL / PHP4 experts? - 05/12/2004 00:09

Quote:
Any change if you explicitly bound the else action with curly braces (or maybe that's a typo?)?

Makes no difference (and neither should it - PHP is basically C syntax).

I know where this is headed - I'm going to have to do a PHP build from source and start tracing inside that. This is payback for using nice easy binary distributions :-(

Rob
Posted by: jimhogan

Re: Any MySQL / PHP4 experts? - 05/12/2004 00:16

Quote:
I know where this is headed - I'm going to have to do a PHP build from source and start tracing inside that. This is payback for using nice easy binary distributions :-(

Being hopelessly lazy, this is where I start introducing things like spelling errors to see if I can get it to puke something up -- like what happens if you change the ADODB constant spelling?)

I have a million other questions, but they are pointless and won't help you

(Edit: Oh, and obligatory /. solution: Switch to PostgreSQL)
Posted by: Tim

Re: Any MySQL / PHP4 experts? - 05/12/2004 01:52

Quote:
The data passed in to the function looks good, and I can connect to MySQL manually without a problem.


Have you tried to connect to MySQL through PHP in a simple script other than this one, or checked phpinfo() to make sure PHP can see MySQL at all?

- Tim
Posted by: Roger

Re: Any MySQL / PHP4 experts? - 05/12/2004 07:52

Quote:
Is there something wierd with MySQL and PHP4 on Debian that I should know about?


Which versions of MySQL and PHP? I know I had some difficulties using the absolutely latest version of MySQL with PHP < 4.5.x. They're probably different, but knowing the version numbers might help...
Posted by: rob

Re: Any MySQL / PHP4 experts? - 06/12/2004 01:20

Debian sarge, 2.6.8 kernel, Apache 2.0.52, PHP 4.3.9, MySQL 4.0.22.

Turns out exactly the same thing happens with postgresql - must be a PHP problem..

Rob
Posted by: peter

Re: Any MySQL / PHP4 experts? - 06/12/2004 11:00

Quote:
Turns out exactly the same thing happens with postgresql

Is $Hostname localhost? in other words, is there an underlying TCP connect going on? If it's non-local, check your DNS is working, use netstat -anp on the server to check the daemon is listening on the port you think it is, and try telnet to that hostname/port from the client to see if the connect succeeds, i.e. if there's any TCP/IP reason why it can't connect to the server. If it is localhost, check whether there's a Unix-domain socket or named pipe that you need to create, and check its permissions.

Peter
Posted by: rob

Re: Any MySQL / PHP4 experts? - 06/12/2004 11:40

It doesn't seem to make any difference what is passed in - i.e. total garbage still does the same thing without so much as an error.

Rob
Posted by: rob

Re: Any MySQL / PHP4 experts? - 06/12/2004 12:17

OK, all fixed, simple permissions problem on the PHP modules path. Duh.

Rob