草庐IT

php - 无法在 ubuntu 中安装和运行 mysqlnd_ms

coder 2024-04-18 原文

我很难在我的 ubuntu 机器上安装 mysqlnd_ms。 遵循的步骤:

  1. 更新我的本地机器以运行 php 7
  2. 已关注 https://github.com/sergiotabanelli/mysqlnd_ms并安装了所需的库
sudo apt-get install libxml2-dev 
sudo apt-get install libmemcached-dev 
sudo apt-get install php-json
  1. make 和 sudo make install
  2. 使用主机名、用户名、密码、数据库创建了一个 json 文件
{
    "myapp": {
        "master": {
            "master_0": {
                "host": "XXXX.rds.amazonaws.com",
                "username":"XXXX",
                "password":"XXXX",
                "database":"XXXX"
            }
        },
        "slave": {
            "slave_0": {
                "host": "XXXX.rds.amazonaws.com",
                "username":"XXXX",
                "password":"XXXX",
                "database":"XXXX",
                "port": "3306"
            }
        }
    }
}
  1. 编辑 php.ini 文件使其具有
 mysqlnd_ms.enable=1      mysqlnd_ms.force_config_usage=1
 mysqlnd_ms.config_file=/etc/mysqlnd_ms_cfg.ini
 extension=mysqlnd_ms.so
  1. 重新启动 Apache 服务

我错过了什么吗? Php 信息仍然没有显示任何与 mysqlnd_ms 相关的信息。

$mysqli = new mysqli("myapp", "username", "password", "database");

给予

php_network_getaddresses: getaddrinfo failed

错误

当试图“make”创建mysqlnd_ms.so文件时 它引发了一个错误,即缺少 php_smart_str.h。在阅读了几个相关线程后了解到 php_smart_str.h 在 php7 中被重命名为 php_smart_string.h。所以添加了一个符号链接(symbolic link)

ln -s  ext/standard/php_smart_string.h ext/standard/php_smart_str.h

现在尝试使用命令再次制作

sudo pecl install mysqlnd_ms

出现以下错误

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

最佳答案

我可以按照以下步骤解决问题

mysqlnd_ms for php7.2安装步骤

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

create a file at /etc/php.d/mysqlnd_ms.ini with following content

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

restart apache server

创建一个php页面
echo phpinfo();

如果插件激活,它会显示

关于php - 无法在 ubuntu 中安装和运行 mysqlnd_ms,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52152454/

有关php - 无法在 ubuntu 中安装和运行 mysqlnd_ms的更多相关文章

  1. ruby - 如何从 ruby​​ 中的字符串运行任意对象方法? - 2

    总的来说,我对ruby​​还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用

  2. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  3. ruby - 如何每月在 Heroku 运行一次 Scheduler 插件? - 2

    在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/

  4. ruby-on-rails - 无法使用 Rails 3.2 创建插件? - 2

    我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby​​1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在

  5. ruby-on-rails - 如何在 ruby​​ 中使用两个参数异步运行 exe? - 2

    exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby​​中使用两个参数异步运行exe吗?我已经尝试过ruby​​命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何ruby​​gems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除

  6. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  7. ruby-on-rails - 无法在centos上安装therubyracer(V8和GCC出错) - 2

    我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e

  8. ruby - 无法让 RSpec 工作—— 'require' : cannot load such file - 2

    我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳

  9. ruby - Sinatra:运行 rspec 测试时记录噪音 - 2

    Sinatra新手;我正在运行一些rspec测试,但在日志中收到了一堆不需要的噪音。如何消除日志中过多的噪音?我仔细检查了环境是否设置为:test,这意味着记录器级别应设置为WARN而不是DEBUG。spec_helper:require"./app"require"sinatra"require"rspec"require"rack/test"require"database_cleaner"require"factory_girl"set:environment,:testFactoryGirl.definition_file_paths=%w{./factories./test/

  10. ruby - 无法覆盖 irb 中的 to_s - 2

    我在pry中定义了一个函数:to_s,但我无法调用它。这个方法去哪里了,怎么调用?pry(main)>defto_spry(main)*'hello'pry(main)*endpry(main)>to_s=>"main"我的ruby版本是2.1.2看了一些答案和搜索后,我认为我得到了正确的答案:这个方法用在什么地方?在irb或pry中定义方法时,会转到Object.instance_methods[1]pry(main)>defto_s[1]pry(main)*'hello'[1]pry(main)*end=>:to_s[2]pry(main)>defhello[2]pry(main)

随机推荐