Hi,
I hope i'm writing in the good mailing list...
Since one year, i'm working on loadbalancing solution for webservers
(usually Apache 2). Behind a cluster of http servers, we can find a
mysql cluster.
Generally ppl are using the mysql_connect with the hostname =
"localhost". When i suggest a loadbalancing solution, the mysql database
is hosted on a different server. So webpages of all virtual hosts need
to be updated to connect on the new hostname; which can be very annoying.
I've patched PHP, and added 2 variables in PHP.ini which are :
mysql.unix_socket = disabled
mysql.force_hostname =
The first one disabled the connection on mysql unix socket and transform
"localhost" in "127.0.0.1". This allows to redirect mysql traffic with
iptables.
The second force mysql_connect to one database whatever the hostname
specified in the mysql_connect function.
I think it can be someting helpful for System Administrators. Tell me ur
feeling about this.
--
PAGES Vincent
System Administrator
France
Why not simply instruct your developers to use the proper host name in
the first place?
Ilia
If only it were so easier...
Unfortunately, last month we moved 600 websites on a unique server to a
solution based on loadbalancing (LVS, 2 dedicated servers with apache
only and a mysql cluster).
The developpers who generally works on ather server which use
"localhost" as the hostname, did not want to change all their
configuration for all websites...
But i agree with u, that it will be better.
PAGES Vincent
System Administrator
France
Ilia Alshanetsky wrote:
Why not simply instruct your developers to use the proper host name in
the first place?Ilia
Note that the system administrator may be a company that offers web hosting
solutions, it's really not practical, nor ethically correct to make a change
that forces every customer to change their scripts and systems so they begin
working again.
I have seen several times that people like me, that run small web hosting and
internet solutions companies, propose something and the answer is resumed to
"instruct your developers to do (the change)", and i can assure that most of
the ppl that runs php systems does it inside accounts provided by this
companies, so I think this kind of omission when considering very small
additions is not an "E_NOTICE", but at least an "E_WARNING" ;)
Why not simply instruct your developers to use the proper host name in
the first place?Ilia
--
Leonardo Pedretti
Axon Sistemas
Líder de Equipo Proyecto Basalto
Hi,
I hope i'm writing in the good mailing list...
Since one year, i'm working on loadbalancing solution for
webservers (usually Apache 2). Behind a cluster of http servers, we
can find a mysql cluster.
Generally ppl are using the mysql_connect with the hostname =
"localhost". When i suggest a loadbalancing solution, the mysql
database is hosted on a different server. So webpages of all
virtual hosts need to be updated to connect on the new hostname;
which can be very annoying.I've patched PHP, and added 2 variables in PHP.ini which are :
mysql.unix_socket = disabled
mysql.force_hostname =The first one disabled the connection on mysql unix socket and
transform "localhost" in "127.0.0.1". This allows to redirect mysql
traffic with iptables.
The second force mysql_connect to one database whatever the
hostname specified in the mysql_connect function.I think it can be someting helpful for System Administrators. Tell
me ur feeling about this.
Well I'll probably start a war with these remarks but your concept
offers easier hosting with MySQL support and this is appealing to me
as I make a lateral move in the hosting market world, here it is anyway.
What you are proposing is something that makes logical business sense
and I would have to agree with you that it would solve a lot of
issues when hosting service that include MySQL support are provided
to a hostee but there is a flaw in this logic.
The flaw is this, the PHP developers aren't interested in what you
are proposing because it only strengthens your position in the
hosting market by making it easier for you to offer PHP and MySQL
services without requiring the hostee to recode his work and offers
no real improvements to PHP itself.
Since it offers no direct benefit to them in the functionality of
PHP, they will refuse this concept, history dictates this, proof is
available if you examine the list archives for other such concepts
that have been refused by the developer under the weak guise of "tell
the hostee to reprogram" which in the opinion of many, is incorrect
in a true business structure, the hoster should never have to ask or
tell the hostee to reprogram works because the PHP developers
wouldn't ensure any transitional features for functionality be
included in the PHP core itself.
In what you propose, I would not allow any decision to be given to
the PHP developers but rather give them no option to do anything but
accept your code changes by force if you believe that your code has
value (my opinion is it does but does my opinion matter?).
This can be achieved and I propose the follow to attain this goal,
change your code (I know, reprograming, but hear me out) so it is
contained within the bundled MySQL source files with defaults for
your INI settings, this would give you the ability to obtain
endorsement and approval from the MySQL developers much easier and
give the PHP developers no opportunity to reject your proposal unless
the decided to reject MySQL support altogether (not likely to occur
unless they are complete morons).
Your requirements to make this happen would be simple, make your
MySQL code enhancements as version friendly as humanly possible,
generate versions for PHP4 and PHP5, test it on as many platforms as
you can, submit this to the MySQL developers with documentation for
your enhancements/changes and I'm sure that they would accept these
changes because it enhances their product in a desirable way.
If you need some platforms to test on, I have at my disposal a
freeBSD (5.4), a Darwin 6.8 (x86 based) and 3 versions of Mac OSX
server (10.2, 10.3 and 10.4) that I could test your code on and I
believe you could find a handful of others on this list to test your
changes just by asking that should pretty much cover all platforms
out there.
--
PAGES Vincent
System Administrator
France
-- Dale
Well, there is an alternative to telling users to change their, code you
can force them to :-)
PHP allows setting of default connection parameters for mysql_connect()
via INI settings and subsequently disabling (turn on SQL safe mode) the
ability to specify them directly.
The ext/MySQL ini settings can be set a per-virtual host basis, so there
is no issue of connection conflicts.
Ilia