Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've installed php5-mysqlnd via:

apt-get install php5-mysqlnd

This is a brand new virgin Debian install with just apache2 and php5 via:

apt-get install apache2
echo "deb unstable main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install php5 php5-dev php5-cli libapache2-mod-php5 php5-mysqlnd

When I do a phpinfo() it shows that mysqlnd is being used.

My question is, where do I place config details to specify the master/slave details so I can use automatic load balancing and read/write splitting?

I've read and followed:

I appended:


To /etc/php5/conf.d/10-mysqlnd.ini

Which now reads:

; configuration for php MySQL module
; priority=10


Unfortunately these settings don't seem to have made any difference as I cannot do a mysql_connect() using the hostname "myapp" as the section name I configured in /etc/php5/mysqlnd_ms_plugin.ini as:

    "myapp": {
        "master": {
            "master_0": {
                "host": "",
                "port": "3306"
        "slave": {
            "slave_0": {
                "host": "",
                "port": "3306"

Can anyone shed light on where I have gone wrong with the config and what I can do to get it working so I can connect using read/write splitting using my replicated DBs?

EDIT: After the comment below I realised I hadn't actually added the mysqlnd_ms plugin. After attempting to install this plugin via pecl I get an error about mysqlnd.h missing.

share|improve this question

you not only need php5-mysqlnd but also mysqlnd_ms plugin ( installed.

share|improve this answer
Ahh really? That explains a lot LOL. I'll give that a go now... – Rob Evans Mar 22 '13 at 16:51
Hmm doesn't really work on Debian... lots of errors. I'm trying dotdeb-based repos now... – Rob Evans Mar 22 '13 at 19:18
My error is not the same as the link you provided. I already searched before posting this and discounted that page. – Rob Evans Mar 24 '13 at 17:41
up vote 1 down vote accepted

So after getting errors about missing mysqlnd.h I switched to DotDeb repos and rebuilt the cloud server from scratch. After that the plugin compiled.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.