|
Posted by Rik on 01/12/07 08:26
howa wrote:
> in the php.ini, i can't only config to use one mysql socket, but my
> applications require connection to ultiple local mysql server, using
> unix socket, listening different port
>
> any hints?
>
> thanks.
$link1 = mysql_connect ( 'localhost:3306','user','pass');
$link2 = mysql_connect ( 'localhost:6000','user','pass');
Etc.
From the manual:
http://www.php.net/manual/en/function.mysql-connect.php
"server
The MySQL server. It can also include a port number. e.g. "hostname:port"
or a path to a local socket e.g. ":/path/to/socket" for the localhost.
If the PHP directive mysql.default_host is undefined (default), then the
default value is 'localhost:3306'. In SQL safe mode, this parameter is
ignored and value 'localhost:3306' is always used."
So, the server specified in the ini is just the default, which php will
connect to if no values are given (so, with the proper values set,
mysql_connect(); could work).
--
Rik Wasmus
Navigation:
[Reply to this message]
|