Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#243319 - 04/12/2004 19:17 Any MySQL / PHP4 experts?
rob
carpal tunnel

Registered: 21/05/1999
Posts: 5335
Loc: Cambridge UK
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

Top
#243320 - 04/12/2004 21:51 Re: Any MySQL / PHP4 experts? [Re: rob]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
Random shot in the dark, is PHP safe mode enabled? What happens when it is disabled?

Top
#243321 - 04/12/2004 22:16 Re: Any MySQL / PHP4 experts? [Re: drakino]
rob
carpal tunnel

Registered: 21/05/1999
Posts: 5335
Loc: Cambridge UK
Nope, disabled.

Rob

Top
#243322 - 04/12/2004 23:26 Re: Any MySQL / PHP4 experts? [Re: rob]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
What is the pconnect function called with as arguments? i.e. what are:

$argHostname,
$argUsername,
$argPassword,
$this->clientFlags
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#243323 - 04/12/2004 23:53 Re: Any MySQL / PHP4 experts? [Re: rob]
jimhogan
carpal tunnel

Registered: 06/10/1999
Posts: 2591
Loc: Seattle, WA, U.S.A.
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.
_________________________
Jim


'Tis the exceptional fellow who lies awake at night thinking of his successes.

Top
#243324 - 05/12/2004 00:07 Re: Any MySQL / PHP4 experts? [Re: Shonky]
rob
carpal tunnel

Registered: 21/05/1999
Posts: 5335
Loc: Cambridge UK
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

Top
#243325 - 05/12/2004 00:09 Re: Any MySQL / PHP4 experts? [Re: jimhogan]
rob
carpal tunnel

Registered: 21/05/1999
Posts: 5335
Loc: Cambridge UK
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

Top
#243326 - 05/12/2004 00:16 Re: Any MySQL / PHP4 experts? [Re: rob]
jimhogan
carpal tunnel

Registered: 06/10/1999
Posts: 2591
Loc: Seattle, WA, U.S.A.
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)


Edited by jimhogan (05/12/2004 00:33)
_________________________
Jim


'Tis the exceptional fellow who lies awake at night thinking of his successes.

Top
#243327 - 05/12/2004 01:52 Re: Any MySQL / PHP4 experts? [Re: rob]
Tim
veteran

Registered: 25/04/2000
Posts: 1529
Loc: Arizona
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

Top
#243328 - 05/12/2004 07:52 Re: Any MySQL / PHP4 experts? [Re: rob]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
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...
_________________________
-- roger

Top
#243329 - 06/12/2004 01:20 Re: Any MySQL / PHP4 experts? [Re: Roger]
rob
carpal tunnel

Registered: 21/05/1999
Posts: 5335
Loc: Cambridge UK
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

Top
#243330 - 06/12/2004 11:00 Re: Any MySQL / PHP4 experts? [Re: rob]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4180
Loc: Cambridge, England
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

Top
#243331 - 06/12/2004 11:40 Re: Any MySQL / PHP4 experts? [Re: peter]
rob
carpal tunnel

Registered: 21/05/1999
Posts: 5335
Loc: Cambridge UK
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

Top
#243332 - 06/12/2004 12:17 Re: Any MySQL / PHP4 experts? [Re: rob]
rob
carpal tunnel

Registered: 21/05/1999
Posts: 5335
Loc: Cambridge UK
OK, all fixed, simple permissions problem on the PHP modules path. Duh.

Rob

Top