LoginSignup
0
0

More than 3 years have passed since last update.

PHP7.3にSSH2導入 yumでかんたん

Last updated at Posted at 2019-06-06

とりあえず最初に結論

yum install --disablerepo=* --enablerepo=remi,remi-php73 php-pecl-ssh2

以下、無駄な試行錯誤のメモ

libssh2手動で入れたけど、なんか最初から入ってた気がする 作業前に要phpinfo確認、エクステンション入れる前でもlibssh2のバージョンは出る

peclのssh2を手動で入れようとするとめちゃくちゃエラーが出る

ちなみに wget https://pecl.php.net/get/ssh2 としたほうがよい 最新がとれる

/root/ssh2-1.1.2/ssh2_fopen_wrappers.c: In function 'php_ssh2_fopen_wraper_parse_path':
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: warning: passing argument 1 of 'strlen' from incompatible pointer t                                ype [enabled by default]
  if (strncmp(resource->scheme, "ssh2.", sizeof("ssh2.") - 1)) {
  ^
In file included from /usr/include/php/main/../main/php_config.h:2623:0,
                 from /usr/include/php/Zend/zend_config.h:1,
                 from /usr/include/php/Zend/zend_portability.h:43,
                 from /usr/include/php/Zend/zend_types.h:25,
                 from /usr/include/php/Zend/zend.h:27,
                 from /usr/include/php/main/php.h:33,
                 from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:25:
/usr/include/string.h:395:15: note: expected 'const char *' but argument is of type 'struct zend_string *'
 extern size_t strlen (const char *__s)
               ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: warning: passing argument 1 of 'strlen' from incompatible pointer t                                ype [enabled by default]
  if (strncmp(resource->scheme, "ssh2.", sizeof("ssh2.") - 1)) {
  ^
In file included from /usr/include/php/main/../main/php_config.h:2623:0,
                 from /usr/include/php/Zend/zend_config.h:1,
                 from /usr/include/php/Zend/zend_portability.h:43,
                 from /usr/include/php/Zend/zend_types.h:25,
                 from /usr/include/php/Zend/zend.h:27,
                 from /usr/include/php/main/php.h:33,
                 from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:25:
/usr/include/string.h:395:15: note: expected 'const char *' but argument is of type 'struct zend_string *'
 extern size_t strlen (const char *__s)
               ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: warning: passing argument 1 of '__builtin_strcmp' from incompatible                                 pointer type [enabled by default]
  if (strncmp(resource->scheme, "ssh2.", sizeof("ssh2.") - 1)) {
  ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: note: expected 'const char *' but argument is of type 'struct zend_                                string *'
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: warning: passing argument 1 of 'strlen' from incompatible pointer t                                ype [enabled by default]
In file included from /usr/include/php/main/../main/php_config.h:2623:0,
                 from /usr/include/php/Zend/zend_config.h:1,
                 from /usr/include/php/Zend/zend_portability.h:43,
                 from /usr/include/php/Zend/zend_types.h:25,
                 from /usr/include/php/Zend/zend.h:27,
                 from /usr/include/php/main/php.h:33,
                 from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:25:
/usr/include/string.h:395:15: note: expected 'const char *' but argument is of type 'struct zend_string *'
 extern size_t strlen (const char *__s)
               ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: warning: passing argument 1 of '__builtin_strcmp' from incompatible                                 pointer type [enabled by default]
  if (strncmp(resource->scheme, "ssh2.", sizeof("ssh2.") - 1)) {
  ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: note: expected 'const char *' but argument is of type 'struct zend_                                string *'
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: warning: passing argument 1 of '__builtin_strcmp' from incompatible                                 pointer type [enabled by default]
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: note: expected 'const char *' but argument is of type 'struct zend_                                string *'
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: warning: passing argument 1 of '__builtin_strcmp' from incompatible                                 pointer type [enabled by default]
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: note: expected 'const char *' but argument is of type 'struct zend_                                string *'
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:236:2: warning: passing argument 1 of 'strncmp' from incompatible pointer                                 type [enabled by default]
In file included from /usr/include/php/main/../main/php_config.h:2623:0,
                 from /usr/include/php/Zend/zend_config.h:1,
                 from /usr/include/php/Zend/zend_portability.h:43,
                 from /usr/include/php/Zend/zend_types.h:25,
                 from /usr/include/php/Zend/zend.h:27,
                 from /usr/include/php/main/php.h:33,
                 from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:25:
/usr/include/string.h:143:12: note: expected 'const char *' but argument is of type 'struct zend_string *'
 extern int strncmp (const char *__s1, const char *__s2, size_t __n)
            ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: warning: passing argument 1 of 'strlen' from incompatible pointer t                                ype [enabled by default]
  if (strcmp(resource->scheme + sizeof("ssh2.") - 1, type)) {
  ^
In file included from /usr/include/php/main/../main/php_config.h:2623:0,
                 from /usr/include/php/Zend/zend_config.h:1,
                 from /usr/include/php/Zend/zend_portability.h:43,
                 from /usr/include/php/Zend/zend_types.h:25,
                 from /usr/include/php/Zend/zend.h:27,
                 from /usr/include/php/main/php.h:33,
                 from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:25:
/usr/include/string.h:395:15: note: expected 'const char *' but argument is of type 'struct zend_string *'
 extern size_t strlen (const char *__s)
               ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: warning: passing argument 1 of '__builtin_strcmp' from incompatible                                 pointer type [enabled by default]
  if (strcmp(resource->scheme + sizeof("ssh2.") - 1, type)) {
  ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: note: expected 'const char *' but argument is of type 'struct zend_                                string *'
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: warning: passing argument 1 of 'strlen' from incompatible pointer t                                ype [enabled by default]
In file included from /usr/include/php/main/../main/php_config.h:2623:0,
                 from /usr/include/php/Zend/zend_config.h:1,
                 from /usr/include/php/Zend/zend_portability.h:43,
                 from /usr/include/php/Zend/zend_types.h:25,
                 from /usr/include/php/Zend/zend.h:27,
                 from /usr/include/php/main/php.h:33,
                 from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:25:
/usr/include/string.h:395:15: note: expected 'const char *' but argument is of type 'struct zend_string *'
 extern size_t strlen (const char *__s)
               ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: warning: passing argument 1 of '__builtin_strcmp' from incompatible                                 pointer type [enabled by default]
  if (strcmp(resource->scheme + sizeof("ssh2.") - 1, type)) {
  ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: note: expected 'const char *' but argument is of type 'struct zend_                                string *'
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: warning: passing argument 1 of '__builtin_strcmp' from incompatible                                 pointer type [enabled by default]
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: note: expected 'const char *' but argument is of type 'struct zend_                                string *'
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: warning: passing argument 1 of '__builtin_strcmp' from incompatible                                 pointer type [enabled by default]
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:242:2: note: expected 'const char *' but argument is of type 'struct zend_                                string *'
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:256:4: warning: assignment from incompatible pointer type [enabled by defa                                ult]
  s = resource->path;
    ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:257:2: warning: passing argument 2 of 'strstr' from incompatible pointer t                                ype [enabled by default]
  resource->path = estrdup(strstr(path, resource->path));
  ^
In file included from /usr/include/php/main/../main/php_config.h:2623:0,
                 from /usr/include/php/Zend/zend_config.h:1,
                 from /usr/include/php/Zend/zend_portability.h:43,
                 from /usr/include/php/Zend/zend_types.h:25,
                 from /usr/include/php/Zend/zend.h:27,
                 from /usr/include/php/main/php.h:33,
                 from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:25:
/usr/include/string.h:338:14: note: expected 'const char *' but argument is of type 'struct zend_string *'
 extern char *strstr (const char *__haystack, const char *__needle)
              ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:257:17: warning: assignment from incompatible pointer type [enabled by def                                ault]
  resource->path = estrdup(strstr(path, resource->path));
                 ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:261:4: warning: assignment from incompatible pointer type [enabled by defa                                ult]
  s = resource->host;
    ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:312:24: error: invalid operands to binary == (have 'zend_string' and 'int'                                )
  if (resource->host[0] == 0 && context && psftp &&
                        ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:326:24: error: invalid operands to binary == (have 'zend_string' and 'int'                                )
  if (resource->host[0] == 0 && context &&
                        ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:402:3: warning: passing argument 1 of 'strlen' from incompatible pointer t                                ype [enabled by default]
   int len = strlen(resource->user);
   ^
In file included from /usr/include/php/main/../main/php_config.h:2623:0,
                 from /usr/include/php/Zend/zend_config.h:1,
                 from /usr/include/php/Zend/zend_portability.h:43,
                 from /usr/include/php/Zend/zend_types.h:25,
                 from /usr/include/php/Zend/zend.h:27,
                 from /usr/include/php/main/php.h:33,
                 from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:25:
/usr/include/string.h:395:15: note: expected 'const char *' but argument is of type 'struct zend_string *'
 extern size_t strlen (const char *__s)
               ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:405:13: warning: assignment from incompatible pointer type [enabled by def                                ault]
    username = resource->user;
             ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:411:3: warning: passing argument 1 of 'strlen' from incompatible pointer t                                ype [enabled by default]
   int len = strlen(resource->pass);
   ^
In file included from /usr/include/php/main/../main/php_config.h:2623:0,
                 from /usr/include/php/Zend/zend_config.h:1,
                 from /usr/include/php/Zend/zend_portability.h:43,
                 from /usr/include/php/Zend/zend_types.h:25,
                 from /usr/include/php/Zend/zend.h:27,
                 from /usr/include/php/main/php.h:33,
                 from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:25:
/usr/include/string.h:395:15: note: expected 'const char *' but argument is of type 'struct zend_string *'
 extern size_t strlen (const char *__s)
               ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:414:13: warning: assignment from incompatible pointer type [enabled by def                                ault]
    password = resource->pass;
             ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:425:2: warning: passing argument 1 of 'php_ssh2_session_connect' from inco                                mpatible pointer type [enabled by default]
  session = php_ssh2_session_connect(resource->host, resource->port, methods, callbacks);
  ^
In file included from /root/ssh2-1.1.2/ssh2_fopen_wrappers.c:26:0:
/root/ssh2-1.1.2/php_ssh2.h:151:18: note: expected 'char *' but argument is of type 'struct zend_string *'
 LIBSSH2_SESSION *php_ssh2_session_connect(char *host, int port, zval *methods, zval *callbacks);
                  ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c: In function 'php_ssh2_fopen_wrapper_shell':
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:634:4: warning: assignment from incompatible pointer type [enabled by defa                                ult]
  s = resource->path ? resource->path : NULL;
    ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c: In function 'php_ssh2_fopen_wrapper_exec':
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:881:2: warning: passing argument 3 of 'php_ssh2_exec_command' from incompa                                tible pointer type [enabled by default]
  stream = php_ssh2_exec_command(session, resource_id, resource->path + 1, terminal, terminal_len, environment, w                                idth, height, type);
  ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:737:20: note: expected 'char *' but argument is of type 'struct zend_strin                                g *'
 static php_stream *php_ssh2_exec_command(LIBSSH2_SESSION *session, int resource_id, char *command, char *term, i                                nt term_len, zval *environment, long width, long height, long type)
                    ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c: In function 'php_ssh2_fopen_wrapper_scp':
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:1024:2: warning: passing argument 3 of 'php_ssh2_scp_xfer' from incompatib                                le pointer type [enabled by default]
  stream = php_ssh2_scp_xfer(session, resource_id, resource->path);
  ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:970:20: note: expected 'char *' but argument is of type 'struct zend_strin                                g *'
 static php_stream *php_ssh2_scp_xfer(LIBSSH2_SESSION *session, int resource_id, char *filename)
                    ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c: In function 'php_ssh2_fopen_wrapper_tunnel':
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:1265:42: error: invalid operands to binary == (have 'zend_string' and 'in                                 ')
  if (resource->path && resource->path[0] == '/') {
                                          ^
/root/ssh2-1.1.2/ssh2_fopen_wrappers.c:1268:8: warning: assignment from incompatible pointer type [enabled by def                                ault]
   host = resource->path + 1;
        ^
make: *** [ssh2_fopen_wrappers.lo] エラー 1
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0