pecl:ssh2 on freebsd 8.1 インストール方法


pecl:ssh2 は freebsd で動作させる場合、現時点では ver 0.11.0 じゃないとエラーが起こるようだ。

ver 0.11.2 の場合、こんな感じ。

# make
/bin/sh /usr/local/src/libtool –mode=compile gcc -I. -I/usr/local/src -DPHP_ATOM_INC -I/usr/local/src/include -I/usr/local/src/main -I/usr/local/src -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/ssh2.c -o ssh2.lo
gcc -I. -I/usr/local/src -DPHP_ATOM_INC -I/usr/local/src/include -I/usr/local/src/main -I/usr/local/src -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/ssh2.c -fPIC -DPIC -o ssh2.lo
/usr/local/src/ssh2.c:50: error: expected ‘)’ before numeric constant
/usr/local/src/ssh2.c: In function ‘php_ssh2_session_connect’:
/usr/local/src/ssh2.c:352: error: ‘php_ssh2_alloc_cb’ undeclared (first use in this function)
/usr/local/src/ssh2.c:352: error: (Each undeclared identifier is reported only once
/usr/local/src/ssh2.c:352: error: for each function it appears in.)
/usr/local/src/ssh2.c: In function ‘zif_ssh2_methods_negotiated’:
/usr/local/src/ssh2.c:498: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:499: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:503: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:504: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:505: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:506: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:511: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:512: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:513: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:514: warning: passing argument 4 of ‘add_assoc_string_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c: In function ‘zif_ssh2_fingerprint’:
/usr/local/src/ssh2.c:553: warning: initialization discards qualifiers from pointer target type
/usr/local/src/ssh2.c: In function ‘zif_ssh2_publickey_add’:
/usr/local/src/ssh2.c:1040: warning: passing argument 1 of ‘_efree’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c: In function ‘zif_ssh2_publickey_list’:
/usr/local/src/ssh2.c:1099: warning: passing argument 4 of ‘add_assoc_stringl_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:1100: warning: passing argument 4 of ‘add_assoc_stringl_ex’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c:1108: warning: initialization discards qualifiers from pointer target type
/usr/local/src/ssh2.c:1109: warning: passing argument 2 of ‘zend_hash_add_or_update’ discards qualifiers from pointer target type
/usr/local/src/ssh2.c: At top level:
/usr/local/src/ssh2.c:1297: error: ‘php_ssh2_first_arg_force_ref’ undeclared here (not in a function)
*** Error code 1

Stop in /usr/local/src.

なので、

cd /usr/ports/security/libssh2
make install

http://pecl.php.net/get/ssh2-0.11.0.tgz
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
make ; make install

これでインストールできる。
後は php.ini に ssh2.so を 書いてあげればいい。
phpize のパスはセットアップする方法によって変わるから注意。

コメントを残す

メールアドレスが公開されることはありません。