mysql_pconnect options

mysql_pconnect options

am 15.01.2009 19:13:27 von Kathy Mazur Worden

I'm setting up a webserver for failover on Linux/Apache and am running
into problems getting mysql_pconnect to work. The primary webserver
(also Linux/Apache) connects to the local MySQL server using:

$Conn = mysql_pconnect("localhost", "user", "password", false, 2) or
die("Could not connect : " . mysql_error());

However the failover server will only connect to it's local MySQL server
if I change the above line by either removing "false, 2" or changing
mysql_pconnect to mysql_connect.

I've googled around for a solution but haven't found anything. Is there
a configuration setting I could have missed? Any other pointers?

TIA
Kathy



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

Re: mysql_pconnect options

am 15.01.2009 22:38:13 von dmagick

Kathy Mazur Worden wrote:
> I'm setting up a webserver for failover on Linux/Apache and am running
> into problems getting mysql_pconnect to work. The primary webserver
> (also Linux/Apache) connects to the local MySQL server using:
>
> $Conn = mysql_pconnect("localhost", "user", "password", false, 2) or
> die("Could not connect : " . mysql_error());

RTM (http://au2.php.net/mysql_pconnect).

The syntax is different to mysql_connect.

resource mysql_pconnect ([ string $server [, string $username [,
string $password [, int $client_flags ]]]] )

After the password, there are client flags and nothing else ("new link"
has no meaning with pconnect).

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


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

Re: mysql_pconnect options

am 15.01.2009 22:54:53 von Kathy Mazur Worden

Thanks, I had been to that page and understood it to mean there are not
2 options that would handle the "false, 2" part, but since
mysql_pconnect works on one server with the options there has to be a
way to get it working on another.


Chris wrote:
> Kathy Mazur Worden wrote:
>> I'm setting up a webserver for failover on Linux/Apache and am running
>> into problems getting mysql_pconnect to work. The primary webserver
>> (also Linux/Apache) connects to the local MySQL server using:
>>
>> $Conn = mysql_pconnect("localhost", "user", "password", false, 2) or
>> die("Could not connect : " . mysql_error());
>
> RTM (http://au2.php.net/mysql_pconnect).
>
> The syntax is different to mysql_connect.
>
> resource mysql_pconnect ([ string $server [, string $username [,
> string $password [, int $client_flags ]]]] )
>
> After the password, there are client flags and nothing else ("new
> link" has no meaning with pconnect).
>

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

Re: mysql_pconnect options

am 15.01.2009 23:01:00 von dmagick

Kathy Mazur Worden wrote:
> Thanks, I had been to that page and understood it to mean there are not
> 2 options that would handle the "false, 2" part, but since
> mysql_pconnect works on one server with the options there has to be a
> way to get it working on another.

If you want to waste time doing that, I guess..

You know you're not setting client_flags to "2" here though right? It's
being set to FALSE.

FALSE in the mysql_connect call is for "new_link". "2" is for the client
flags - and you're better off using the constants defined so you don't
have to go back and look at what you're setting.

Different php versions? What happens on the server that doesn't work? Do
you get an error, do you get a segfault, something else ?

Do you have error_reporting(E_ALL) and ini_set('display_errors', true)
set so you'd notice any problems/messages?


Just change the pconnect call to not include the "new_link" option.

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


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