You are here: Re: How to use multiplce MySQL socket on a single web server? « PHP Programming Language « IT news, forums, messages
Re: How to use multiplce MySQL socket on a single web server?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация