Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to get the mysqlnd_ms (master_slave) plugin to run, but receive the error that the config file contains and unexpected bracket. To make sure I didn't corrupt anything, I replicated this error on a fresh install. Both installs are Ubuntu 12.04-LTS using the packaged PHP-5.3.10 and are running through Apache's module. Because the php5-dev package does not contain the headers for mysqlnd, I had to jump through some hoops to get PECL to install the package.

I am following the guide from MySQL's website 20.7.6.4. Quickstart and Examples

Here is the error I am seeing:

root@mysqlndms:~# php -v
PHP:  syntax error, unexpected '{' in /etc/php5/cli/conf.d/mysqlnd_ms_plugin.ini on line 1
PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 14:34:31)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
root@mysqlndms:~#

And this is the contents of the .ini file:

root@mysqlndms:~# cat /etc/php5/cli/conf.d/mysqlnd_ms_plugin.ini
{
    "myapp": {
        "master": {
            "master_0": {
                "host": "localhost"
            }
        },
        "slave": [

        ]
    }
}
root@mysqlndms:~#

This .ini file is copied straight from MySQL's tutorial.

For completeness, here are the hoops I had to jump through to get the PECL package to build:

cd /usr/local/src/
apt-get source php5
cd php5-5.3.10/ext/
cp -a mysqlnd/ /usr/include/php5/ext/
cd /usr/local/src/php5-5.3.10/ext/mysqlnd/
mv config9.m4 config.m4
sed -ie "s{ext/mysqlnd/php_mysqlnd_config.h{config.h{" mysqlnd_portability.h
phpize
cp -a mysqlnd_portability.h /usr/include/php5/ext/mysqlnd/
pecl install mysqlnd_ms

I am really at a loss as where to go from here and would love a gentle push in the right direction. I'm not afraid to compile from source, but would really like to use the packages if at all possible.

Thanks!

share|improve this question
    
Are you enabling the extension? Look at the output of phpinfo(). –  Mark Wagner Mar 25 '13 at 20:48
    
@MarkWagner Yes, I do see it enabled from phpinfo(). In fact, if I comment out the extension, and associated settings, it still throws the error. Just having that config file in the conf.d directory throws it; moving it to my home directory clears the error. So there must be something about how the config file is formatted. –  Ken S. Mar 26 '13 at 13:41
    
Reducing the config file to just a single line with a pair of brackets still throws the same error. Only by making it an empty file am I able to clear the error; which, obviously, doesn't do me any good. –  Ken S. Mar 26 '13 at 13:48

1 Answer 1

up vote 1 down vote accepted

mysqlnd_ms_plugin.ini is not a php config file. In a php config file you put:

mysqlnd_ms.enable=1
mysqlnd_ms.config_file=/path/to/mysqlnd_ms_plugin.ini

Where /path/to/ is not /etc/php5/cli/conf.d/ or any other place php reads ini files.

share|improve this answer
    
Thanks. That is exactly what I had just found out. If I moved it outside of conf.d/ then it would work, but since I wanted to keep them logically grouped together, I left it in the same directory but changed the extension from .ini to .cnf and now PHP does not try to parse it and everything works. –  Ken S. Mar 26 '13 at 19:50

Your Answer

 
discard

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.