首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在ubuntu中安装和运行mysqlnd_ms

无法在ubuntu中安装和运行mysqlnd_ms
EN

Stack Overflow用户
提问于 2018-09-03 15:19:04
回答 1查看 764关注 0票数 4

我很难在我的ubuntu机器上安装mysqlnd_ms。采取的步骤如下:

  1. 更新我的本地机器以运行php 7
  2. 遵循ms并安装所需的库

sudo apt-get install libxml2 2-dev sudo apt-get install libmemcached-dev sudo apt-get install php-json

  1. 制造和制造安装
  2. 创建具有主机名、用户名、密码、数据库的json文件。

{ "myapp":{ "master_0":{ "XXXX.rds.amazonaws.com“、”用户名“:”XXXX“、”密码“:”XXXX“、”数据库“:”XXXX“},“从”:{ "slave_0":{“主机”:"XXXX.rds.amazonaws.com",“用户名”:“XXXX”,“密码”:“XXXX”,“数据库”:“XXXX”,“端口”:"3306“}}

  1. 编辑的php.ini文件

mysqlnd_ms.config_file=/etc/mysqlnd_ms_cfg.ini mysqlnd_ms.enable=1 mysqlnd_ms.force_config_usage=1 extension=mysqlnd_ms.so

  1. 重新启动Apache服务

我有遗漏什么吗。Php仍然没有显示任何与mysqlnd_ms相关的内容。

代码语言:javascript
复制
$mysqli = new mysqli("myapp", "username", "password", "database");

给出

php_network_getaddresses: getaddrinfo失败

错误

当试图“创建”创建mysqlnd_ms.so文件时,它抛出了一个php_smart_str.h丢失的错误。在阅读了几个相关线程之后,了解到php_smart_str.h在php7中被重命名为php_smart_string.h。所以增加了一个符号链接

代码语言:javascript
复制
ln -s  ext/standard/php_smart_string.h ext/standard/php_smart_str.h

现在,当尝试再次使用命令进行创建时

代码语言:javascript
复制
sudo pecl install mysqlnd_ms

它给出了以下错误

代码语言:javascript
复制
running: make
    /bin/bash /tmp/pear/temp/pear-build-rootNt6r2K/mysqlnd_ms-1.5.2/libtool
--mode=compile cc  -I. -I/tmp/pear/temp/mysqlnd_ms -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootNt6r2K/mysqlnd_ms-1.5.2/include -I/tmp/pear/temp/pear-build-rootNt6r2K/mysqlnd_ms-1.5.2/main -I/tmp/pear/temp/mysqlnd_ms -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c -o php_mysqlnd_ms.lo
    libtool: compile:  cc -I. -I/tmp/pear/temp/mysqlnd_ms -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootNt6r2K/mysqlnd_ms-1.5.2/include -I/tmp/pear/temp/pear-build-rootNt6r2K/mysqlnd_ms-1.5.2/main -I/tmp/pear/temp/mysqlnd_ms -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c  -fPIC -DPIC -o .libs/php_mysqlnd_ms.o
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c: In function ‘zm_startup_mysqlnd_ms’:
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:161:3: error: too few arguments to function ‘mysqlnd_stats_init’
       mysqlnd_stats_init(&mysqlnd_ms_stats, MS_STAT_LAST);
       ^
    In file included from /tmp/pear/temp/mysqlnd_ms/mysqlnd_ms.h:34:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:34:
    /usr/include/php/20151012/ext/mysqlnd/mysqlnd_statistics.h:160:13: note: declared here
     PHPAPI void mysqlnd_stats_init(MYSQLND_STATS ** stats, size_t statistic_count, int persistent);
                 ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c: In function ‘zm_shutdown_mysqlnd_ms’:
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:206:3: error: too few arguments to function ‘mysqlnd_stats_end’
       mysqlnd_stats_end(mysqlnd_ms_stats);
       ^
    In file included from /tmp/pear/temp/mysqlnd_ms/mysqlnd_ms.h:34:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:34:
    /usr/include/php/20151012/ext/mysqlnd/mysqlnd_statistics.h:161:13: note: declared here
     PHPAPI void mysqlnd_stats_end(MYSQLND_STATS * stats, int persistent);
                 ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c: In function ‘zif_mysqlnd_ms_get_last_used_connection’:
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:293:21: error: too few arguments to function ‘zval_to_mysqlnd’
      if (!(proxy_conn = zval_to_mysqlnd(handle TSRMLS_CC))) {
                         ^
    In file included from /tmp/pear/temp/mysqlnd_ms/mysqlnd_ms.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:34:
    /usr/include/php/20151012/ext/mysqlnd/mysqlnd_reverse_api.h:36:18: note: declared here
     PHPAPI MYSQLND * zval_to_mysqlnd(zval * zv, const unsigned int client_api_capabilities, unsigned int * save_client_api_capabilities);
                      ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:301:3: error: too many arguments to function ‘add_assoc_string_ex’
       add_assoc_string_ex(return_value, "scheme", sizeof("scheme"), conn->scheme? conn->scheme:"", 1);
       ^
    In file included from /usr/include/php/20151012/main/php.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_API.h:397:14: note: declared here
     ZEND_API int add_assoc_string_ex(zval *arg, const char *key, size_t key_len, char *str);
                  ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:302:3: error: too many arguments to function ‘add_assoc_string_ex’
       add_assoc_string_ex(return_value, "host_info", sizeof("host_info"), conn->host_info? conn->host_info:"", 1);
       ^
    In file included from /usr/include/php/20151012/main/php.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_API.h:397:14: note: declared here
     ZEND_API int add_assoc_string_ex(zval *arg, const char *key, size_t key_len, char *str);
                  ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:303:3: error: too many arguments to function ‘add_assoc_string_ex’
       add_assoc_string_ex(return_value, "host", sizeof("host"), conn->host? conn->host:"", 1);
       ^
    In file included from /usr/include/php/20151012/main/php.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_API.h:397:14: note: declared here
     ZEND_API int add_assoc_string_ex(zval *arg, const char *key, size_t key_len, char *str);
                  ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:305:3: error: too many arguments to function ‘add_assoc_string_ex’
       add_assoc_string_ex(return_value, "socket_or_pipe", sizeof("socket_or_pipe"), conn->unix_socket? conn->unix_socket:"", 1);
       ^
    In file included from /usr/include/php/20151012/main/php.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_API.h:397:14: note: declared here
     ZEND_API int add_assoc_string_ex(zval *arg, const char *key, size_t key_len, char *str);
                  ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:307:3: error: too many arguments to function ‘add_assoc_string_ex’
       add_assoc_string_ex(return_value, "last_message", sizeof("last_message"), conn->last_message? conn->last_message:"", 1);
       ^
    In file included from /usr/include/php/20151012/main/php.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_API.h:397:14: note: declared here
     ZEND_API int add_assoc_string_ex(zval *arg, const char *key, size_t key_len, char *str);
                  ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:309:3: error: too many arguments to function ‘add_assoc_string_ex’
       add_assoc_string_ex(return_value, "error", sizeof("error"), (char *) MYSQLND_MS_ERROR_INFO(conn).error, 1);
       ^
    In file included from /usr/include/php/20151012/main/php.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_API.h:397:14: note: declared here
     ZEND_API int add_assoc_string_ex(zval *arg, const char *key, size_t key_len, char *str);
                  ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:310:3: error: too many arguments to function ‘add_assoc_string_ex’
       add_assoc_string_ex(return_value, "sqlstate", sizeof("sqlstate"), (char *) MYSQLND_MS_ERROR_INFO(conn).sqlstate, 1);
       ^
    In file included from /usr/include/php/20151012/main/php.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_API.h:397:14: note: declared here
     ZEND_API int add_assoc_string_ex(zval *arg, const char *key, size_t key_len, char *str);
                  ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c: In function ‘zif_mysqlnd_ms_get_last_gtid’:
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:333:21: error: too few arguments to function ‘zval_to_mysqlnd’
      if (!(proxy_conn = zval_to_mysqlnd(handle TSRMLS_CC))) {
                         ^
    In file included from /tmp/pear/temp/mysqlnd_ms/mysqlnd_ms.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:34:
    /usr/include/php/20151012/ext/mysqlnd/mysqlnd_reverse_api.h:36:18: note: declared here
     PHPAPI MYSQLND * zval_to_mysqlnd(zval * zv, const unsigned int client_api_capabilities, unsigned int * save_client_api_capabilities);
                      ^
    In file included from /tmp/pear/temp/mysqlnd_ms/mysqlnd_ms.h:37:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:34:
    /tmp/pear/temp/mysqlnd_ms/mysqlnd_ms_enum_n_def.h:37:51: error: too few arguments to function ‘ms_orig_mysqlnd_conn_methods->send_query’
     #define MS_CALL_ORIGINAL_CONN_DATA_METHOD(method) ms_orig_mysqlnd_conn_methods->method
                                                       ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:365:15: note: in expansion of macro ‘MS_CALL_ORIGINAL_CONN_DATA_METHOD’
       if (PASS != MS_CALL_ORIGINAL_CONN_DATA_METHOD(send_query)(conn, (*conn_data)->global_trx.fetch_last_gtid, (*conn_data)->global_trx.fetch_last_gtid_len TSRMLS_CC)) {
                   ^
    /tmp/pear/temp/mysqlnd_ms/mysqlnd_ms_enum_n_def.h:37:51: error: too few arguments to function ‘ms_orig_mysqlnd_conn_methods->reap_query’
     #define MS_CALL_ORIGINAL_CONN_DATA_METHOD(method) ms_orig_mysqlnd_conn_methods->method
                                                       ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:369:16: note: in expansion of macro ‘MS_CALL_ORIGINAL_CONN_DATA_METHOD’
       if (PASS !=  MS_CALL_ORIGINAL_CONN_DATA_METHOD(reap_query)(conn TSRMLS_CC)) {
                    ^
    /tmp/pear/temp/mysqlnd_ms/mysqlnd_ms_enum_n_def.h:37:51: error: too few arguments to function ‘ms_orig_mysqlnd_conn_methods->store_result’
     #define MS_CALL_ORIGINAL_CONN_DATA_METHOD(method) ms_orig_mysqlnd_conn_methods->method
                                                       ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:373:15: note: in expansion of macro ‘MS_CALL_ORIGINAL_CONN_DATA_METHOD’
       if (!(res = MS_CALL_ORIGINAL_CONN_DATA_METHOD(store_result)(conn TSRMLS_CC))) {
                   ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:379:3: warning: implicit declaration of function ‘MAKE_STD_ZVAL’ [-Wimplicit-function-declaration]
       MAKE_STD_ZVAL(row);
       ^
    In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
                     from /usr/include/php/20151012/main/php.h:36,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
     #define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
                                                    ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:382:4: note: in expansion of macro ‘zval_ptr_dtor’
        zval_ptr_dtor(&row);
        ^
    /usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct _zval_struct }’ but argument is of type ‘zval * {aka struct _zval_struct **}’
     ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
                   ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:387:18: error: too many arguments to function ‘zend_hash_index_find’
       if (SUCCESS == zend_hash_index_find(Z_ARRVAL_P(row), 0, (void**)&gtid)) {
                      ^
    In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
                     from /usr/include/php/20151012/main/php.h:36,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_hash.h:156:30: note: declared here
     ZEND_API zval* ZEND_FASTCALL zend_hash_index_find(const HashTable *ht, zend_ulong h);
                                  ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:389:22: warning: implicit declaration of function ‘Z_STRVAL_PP’ [-Wimplicit-function-declaration]
        strncpy(gtid_str, Z_STRVAL_PP(gtid), sizeof(gtid_str) - 1);
                          ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:389:22: warning: passing argument 2 of ‘strncpy’ makes pointer from integer without a cast [-Wint-conversion]
    In file included from /usr/include/features.h:367:0,
                     from /usr/include/stdlib.h:24,
                     from /usr/include/php/20151012/main/php_config.h:2512,
                     from /usr/include/php/20151012/main/php.h:34,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/x86_64-linux-gnu/bits/string3.h:123:1: note: expected ‘const char * restrict’ but argument is of type ‘int’
     _NTH (strncpy (char *restrict __dest, const char *_restrict __src,
     ^
    In file included from /usr/include/php/20151012/Zend/zend.h:39:0,
                     from /usr/include/php/20151012/main/php.h:36,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:26:
    /usr/include/php/20151012/Zend/zend_variables.h:122:48: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [-Wincompatible-pointer-types]
     #define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
                                                    ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:390:4: note: in expansion of macro ‘zval_ptr_dtor’
        zval_ptr_dtor(&row);
        ^
    /usr/include/php/20151012/Zend/zend_variables.h:112:15: note: expected ‘zval * {aka struct _zval_struct }’ but argument is of type ‘zval * {aka struct _zval_struct **}’
     ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
                   ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:392:29: error: macro "RETURN_STRING" passed 2 arguments, but takes just 1
        RETURN_STRING(gtid_str, 1);
                                 ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:392:4: error: ‘RETURN_STRING’ undeclared (first use in this function)
        RETURN_STRING(gtid_str, 1);
        ^
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:392:4: note: each undeclared identifier is reported only once for each function it appears in
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c: In function ‘zif_mysqlnd_ms_set_qos’:
    /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:506:21: error: too few arguments to function ‘zval_to_mysqlnd’
      if (!(proxy_conn = zval_to_mysqlnd(handle TSRMLS_CC))) {
                         ^
    In file included from /tmp/pear/temp/mysqlnd_ms/mysqlnd_ms.h:40:0,
                     from /tmp/pear/temp/mysqlnd_ms/php_mysqlnd_ms.c:34:
    /usr/include/php/20151012/ext/mysqlnd/mysqlnd_reverse_api.h:36:18: note: declared here
     PHPAPI MYSQLND * zval_to_mysqlnd(zval * zv, const unsigned int client_api_capabilities, unsigned int * save_client_api_capabilities);
                      ^
    Makefile:194: recipe for target 'php_mysqlnd_ms.lo' failed
    make: * [php_mysqlnd_ms.lo] Error 1
    ERROR: `make' failed
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-09-07 08:27:29

我能够通过以下步骤解决这个问题

php7.2的mysqlnd_ms安装步骤

代码语言:javascript
复制
sudo yum update -y 
sudo yum install -y  php72-mysqlnd php72-devel  libmemcached  libmemcached-devel  libxml2 libxml2-devel git gcc 
git clone https://github.com/sergiotabanelli/mysqlnd_ms.git
cd mysqlnd_ms
phpize
./configure
make
sudo make install

在/etc/php.d/mysqlnd_ms.ini创建一个文件,内容如下

代码语言:javascript
复制
mysqlnd_ms.enable=1
mysqlnd_ms.force_config_usage=1
mysqlnd_ms.config_file=/etc/mysqlnd_ms_cfg.ini
extension=mysqlnd_ms.so

重新启动apache服务器

创建一个php页面

代码语言:javascript
复制
echo phpinfo();

如果插件是活动的,它将显示。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52152454

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档