我的PHP5.5设置未检测到mysqlnd_ms插件。
我安装了mysqlnd并使用PDO和mysqli启用了它。
> php -m | grep mysqlnd
mysqlnd
它显示在php -i
> php -i > dump; vim dump
mysqlnd
mysqlnd => enabled
Version => mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $
Compression => supported
core SSL => supported
extended SSL => supported
Command buffer size => 4096
Read buffer size => 32768
Read timeout => 31536000
Collecting statistics => Yes
Collecting memory statistics => No
Tracing => n/a
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_sha256_password
API Extensions => mysql,mysqli,pdo_mysql
这是mysqlnd的ini文件,我启用了mysqlnd_ms
cat /etc/php5/cli/conf.d/10-mysqlnd.ini
; configuration for php MySQL module
; priority=10
extension=mysqlnd.so
mysqlnd_ms.enable=1
mysqlnd_ms.config_file=/etc/php5/mysqlnd_ms_plugin.ini
mysqlnd_ms.force_config_usage=1
这是配置了群集的json文件
cat /etc/php5/mysqlnd_ms_plugin.ini
{
"mysqlndapp": {
"master": {
"master_0": {
"host": "192.168.0.45",
"socket": "3306"
}
},
"slave": {
"slave_0": {
"host": "192.168.0.45",
"port": "3307"
}
}
}
}
我使用apt
安装了mysqlndsudo apt-get install php5-mysqlnd
在运行时,我收到此错误
php -d mysqlnd_ms.enable=1 -d mysqlnd_ms.config_file=/etc/php5/mysqlnd_ms_plugin.ini test.php
PHP Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/symfony-cli/Symfony/app/test.php on line 3
PHP Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/symfony-cli/Symfony/app/test.php on line 3
[2002] php_network_getaddresses: getaddrinfo failed: Name or service not known