php ssh2扩展 make: *** [ssh2.lo] Error 1 的解决方法

游子最近折腾一个php的ssh2扩展,在编译php扩展模块时候,可能会在./configure没有报错,而make的时候出现这样的问题。
ssh2扩展

/root/ssh2-0.12/ssh2.c: In function ‘zif_ssh2_publickey_remove’:
/root/ssh2-0.12/ssh2.c:1083:28: error: expected expression before ‘php_ssh2_pkey_subsys_data’
  ZEND_FETCH_RESOURCE(data, php_ssh2_pkey_subsys_data*, &zpkey_data, -1, PHP_SSH2_PKEY_SUBSYS_RES_NAME, le_ssh2_pkey_subsys);
                            ^
/root/ssh2-0.12/ssh2.c: In function ‘zif_ssh2_publickey_list’:
/root/ssh2-0.12/ssh2.c:1107:28: error: expected expression before ‘php_ssh2_pkey_subsys_data’
  ZEND_FETCH_RESOURCE(data, php_ssh2_pkey_subsys_data*, &zpkey_data, -1, PHP_SSH2_PKEY_SUBSYS_RES_NAME, le_ssh2_pkey_subsys);
                            ^
/root/ssh2-0.12/ssh2.c:1122:67: error: macro "add_assoc_stringl" passed 5 arguments, but takes just 4
   add_assoc_stringl(key, "name", keys[i].name, keys[i].name_len, 1);
                                                                   ^
/root/ssh2-0.12/ssh2.c:1122:3: error: ‘add_assoc_stringl’ undeclared (first use in this function)
   add_assoc_stringl(key, "name", keys[i].name, keys[i].name_len, 1);
   ^
/root/ssh2-0.12/ssh2.c:1123:67: error: macro "add_assoc_stringl" passed 5 arguments, but takes just 4
   add_assoc_stringl(key, "blob", keys[i].blob, keys[i].blob_len, 1);
                                                                   ^
/root/ssh2-0.12/ssh2.c:1131:76: error: macro "ZVAL_STRINGL" passed 4 arguments, but takes just 3
    ZVAL_STRINGL(attr, keys[i].attrs[j].value, keys[i].attrs[j].value_len, 1);
                                                                            ^
/root/ssh2-0.12/ssh2.c:1131:4: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
    ZVAL_STRINGL(attr, keys[i].attrs[j].value, keys[i].attrs[j].value_len, 1);
    ^
/root/ssh2-0.12/ssh2.c:1132:125: error: macro "zend_hash_add" passed 6 arguments, but takes just 3
    zend_hash_add(Z_ARRVAL_P(attrs), keys[i].attrs[j].name, keys[i].attrs[j].name_len + 1, (void**)&attr, sizeof(zval*), NULL);
                                                                                                                             ^
/root/ssh2-0.12/ssh2.c:1132:4: error: ‘zend_hash_add’ undeclared (first use in this function)
    zend_hash_add(Z_ARRVAL_P(attrs), keys[i].attrs[j].name, keys[i].attrs[j].name_len + 1, (void**)&attr, sizeof(zval*), NULL);
    ^
In file included from /root/ssh2-0.12/ssh2.c:28:0:
/root/ssh2-0.12/ssh2.c: In function ‘zif_ssh2_auth_agent’:
/root/ssh2-0.12/php_ssh2.h:145:30: error: expected expression before ‘LIBSSH2_SESSION’
 ZEND_FETCH_RESOURCE(session, LIBSSH2_SESSION*, &zsession, -1, PHP_SSH2_SESSION_RES_NAME, le_ssh2_session); \
                              ^
/root/ssh2-0.12/ssh2.c:1162:2: note: in expansion of macro ‘SSH2_FETCH_NONAUTHENTICATED_SESSION’
  SSH2_FETCH_NONAUTHENTICATED_SESSION(session, zsession);
  ^
/root/ssh2-0.12/ssh2.c: At top level:
/root/ssh2-0.12/ssh2.c:1228:35: error: unknown type name ‘zend_rsrc_list_entry’
 static void php_ssh2_session_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
                                   ^
/root/ssh2-0.12/ssh2.c:1258:36: error: unknown type name ‘zend_rsrc_list_entry’
 static void php_ssh2_listener_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
                                    ^
/root/ssh2-0.12/ssh2.c:1268:39: error: unknown type name ‘zend_rsrc_list_entry’
 static void php_ssh2_pkey_subsys_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
                                       ^
/root/ssh2-0.12/ssh2.c: In function ‘zm_startup_ssh2’:
/root/ssh2-0.12/ssh2.c:1282:55: error: ‘php_ssh2_session_dtor’ undeclared (first use in this function)
  le_ssh2_session  = zend_register_list_destructors_ex(php_ssh2_session_dtor, NULL, PHP_SSH2_SESSION_RES_NAME, module_number);
                                                       ^
/root/ssh2-0.12/ssh2.c:1283:55: error: ‘php_ssh2_listener_dtor’ undeclared (first use in this function)
  le_ssh2_listener = zend_register_list_destructors_ex(php_ssh2_listener_dtor, NULL, PHP_SSH2_LISTENER_RES_NAME, module_number);
                                                       ^
/root/ssh2-0.12/ssh2.c:1284:52: error: ‘php_ssh2_sftp_dtor’ undeclared (first use in this function)
  le_ssh2_sftp  = zend_register_list_destructors_ex(php_ssh2_sftp_dtor, NULL, PHP_SSH2_SFTP_RES_NAME, module_number);
                                                    ^
/root/ssh2-0.12/ssh2.c:1285:58: error: ‘php_ssh2_pkey_subsys_dtor’ undeclared (first use in this function)
  le_ssh2_pkey_subsys = zend_register_list_destructors_ex(php_ssh2_pkey_subsys_dtor, NULL, PHP_SSH2_PKEY_SUBSYS_RES_NAME, module_number);
                                                          ^
make: *** [ssh2.lo] Error 1

这个原因原来是版本问题,需要我们将源码的版本换成稳定版本即可。

php ssh2扩展 make: *** [ssh2.lo] Error 1 的解决方法 pecl安装ssh2:https://pecl.php.net/package/ssh2 这里获取最新版本!

用支付宝打赏用支付宝打赏 用微信打赏用微信打赏

如果文章对你有帮助,欢迎点击上方按钮打赏作者


最后编辑于:2018/12/19作者: 游子

热爱一切美好的新事物,搞网站也被网站搞,剁手折腾。关注与学习Web相关技术与UI\UE\UED\UCD\Server相关知识,服务器运维、前端、后端、非专业程序猿、非高级前端后端攻城师!

暂无评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注

arrow grin ! ? cool roll eek evil razz mrgreen smile oops lol mad twisted wink idea cry shock neutral sad ???