우분투 libssh2-php 설치

(PHP Fatal error: Call to undefined function ssh2 connect()에서 넘어옴)

1 개요[ | ]

우분투 libssh2-php 설치
우분투 PHP SSH2 모듈 설치
PHP Fatal error: Call to undefined function ssh2_connect()
PHP Fatal error: Uncaught Error: Call to undefined function ssh2_connect()
  • pecl을 통한 설치방법도 있으나 여기서는 apt-get으로 설치함

2 확인[ | ]

root@zetawiki:~# php -r "ssh2_connect();"
PHP Fatal error:  Call to undefined function ssh2_connect() in Command line code on line 1
root@zetawiki:~# php -m | grep ssh2
root@zetawiki:~# aptitude show libssh2-php | grep ^State
State: not installed
root@zetawiki:~# aptitude search libssh2-php
p   libssh2-php                           - PHP Bindings for libssh2                       
p   libssh2-php:i386                      - PHP Bindings for libssh2

3 설치[ | ]

# ubuntu14, php5
apt-get install libssh2-php
# ubuntu16, php7
apt-get install php-ssh2
root@zetawiki:~# apt-get install libssh2-php
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libssh2-1
The following NEW packages will be installed:
  libssh2-1 libssh2-php
0 upgraded, 2 newly installed, 0 to remove and 117 not upgraded.
Need to get 91.0 kB of archives.
After this operation, 389 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libssh2-1 amd64 1.4.3-2 [66.3 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libssh2-php amd64 0.12-1build1 [24.7 kB]
... (생략)
Setting up libssh2-1:amd64 (1.4.3-2) ...
Setting up libssh2-php (0.12-1build1) ...

Creating config file /etc/php5/mods-available/ssh2.ini with new version
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...

4 확인 2[ | ]

root@zetawiki:~# aptitude show libssh2-php | grep ^State
State: installed
root@zetawiki:~# php -m | grep ssh2
ssh2
root@zetawiki:~# php -r "ssh2_connect();"
PHP Warning:  ssh2_connect() expects at least 1 parameter, 0 given in Command line code on line 1

5 같이 보기[ | ]

6 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}