"CentOS php-pecl-ssh2 설치"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 2명의 중간 판 21개는 보이지 않습니다)
1번째 줄: 1번째 줄:
{{테스트|CentOS 6.3}}
{{테스트|CentOS 6.3}}
;PHP에서 SSH2 터널링 사용
;PHP에서 SSH2 터널링 사용
;리눅스 php-pecl-ssh2 설치


==테스트==
==확인==
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# php -r "ssh2_tunnel();"
[root@zetawiki ~]# rpm -qa | grep php-pecl-ssh2
[root@zetawiki ~]# php -r "ssh2_tunnel();"
PHP Fatal error:  Call to undefined function ssh2_tunnel() in Command line code on line 1
PHP Fatal error:  Call to undefined function ssh2_tunnel() in Command line code on line 1


Fatal error: Call to undefined function ssh2_tunnel() in Command line code on line 1
Fatal error: Call to undefined function ssh2_tunnel() in Command line code on line 1
</source>
</syntaxhighlight>
:→ ssh2_tunnel 명령어를 인식하지 못함.
:→ ssh2_tunnel 명령어를 인식하지 못함.
<syntaxhighlight lang='console'>
[root@zetawiki ~]# yum list php-pecl-ssh2
... (생략)
Error: No matching Packages to list
</syntaxhighlight>
:→ yum으로 설치 불가


==epel rpm 설치==
==epel-release 설치==
php-pecl-ssh2 패키지를 설치해야 하는데, CentOS yum에는 해당 패키지가 없다.
{{참고|epel-release 설치}}
<source lang='dos'>
[root@jmnote ~]# yum info php-pecl-ssh2
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Error: No matching Packages to list
</source>
Fedora epel 이 제공하는 yum 저장소에는 있기 때문에 epel을 설치한다.
*http://download.fedoraproject.org/pub/epel/6/i386/ 접속하여 epel-release rpm 파일 최신버전 찾기
*rpm 파일의 링크 주소 복사 (예: http://ftp.neowiz.com/fedora-epel/6/i386/epel-release-6-8.noarch.rpm )
<source lang='dos'>
[root@jmnote ~]# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.FMgJOv: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
  1:epel-release          ########################################### [100%]
</source>


==php-pecl-ssh2 설치==
==php-pecl-ssh2 설치==
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# yum install php-pecl-ssh2
[root@zetawiki ~]# yum install php-pecl-ssh2
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink                                                                                              | 5.2 kB    00:00   
* epel: ftp.neowiz.com
epel                                                                                                        | 4.3 kB    00:00   
... (생략)
... (생략)
===================================================================================================================================
===================================================================================================================================
51번째 줄: 38번째 줄:
Total download size: 31 k
Total download size: 31 k
Installed size: 73 k
Installed size: 73 k
Is this ok [y/N]:
Is this ok [y/N]: y
</source>
</syntaxhighlight>
:y {{Enter}}
<syntaxhighlight lang='console'>
<source lang='dos'>
Downloading Packages:
php-pecl-ssh2-0.11.0-7.el6.x86_64.rpm                                                                      |  31 kB    00:00   
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6) <epel@fedoraproject.org>
Package: epel-release-6-8.noarch (installed)
From  : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]:
</source>
:y {{Enter}}
<source lang='dos'>
Running rpm_check_debug
... (생략)
... (생략)
Installed:
Installed:
73번째 줄: 46번째 줄:


Complete!
Complete!
</source>
</syntaxhighlight>


==확인 및 아파치 재시작==
==확인 2==
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# php -r "ssh2_tunnel();"
[root@zetawiki ~]# rpm -qa | grep php-pecl-ssh2
php-pecl-ssh2-0.11.0-7.el6.x86_64
</syntaxhighlight>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# php -r "ssh2_tunnel();"
PHP Warning:  ssh2_tunnel() expects exactly 3 parameters, 0 given in Command line code on line 1
PHP Warning:  ssh2_tunnel() expects exactly 3 parameters, 0 given in Command line code on line 1


Warning: ssh2_tunnel() expects exactly 3 parameters, 0 given in Command line code on line 1
Warning: ssh2_tunnel() expects exactly 3 parameters, 0 given in Command line code on line 1
</source>
</syntaxhighlight>
:→ PHP 모듈이 ssh2_tunnel 함수를 인식하였다.
:→ PHP 모듈이 ssh2_tunnel 함수를 인식하였다.


이제 아파치를 재시작하면 ssh2 기능을 사용할 수 있다.
*웹에도 적용하려면 아파치를 재시작해야 한다.
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# service httpd restart
[root@zetawiki ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
</source>
</syntaxhighlight>
 
==같이 보기==
*[[CentOS5 php-pecl-ssh2 설치]]
*[[우분투 libssh2-php 설치]]
*[[PHP에서 SSH 로그인 점검]]
*[[EPEL 저장소 제거]]
*[[SSH]]


[[분류: PHP]]
[[분류: PHP]]

2020년 11월 2일 (월) 00:55 기준 최신판

PHP에서 SSH2 터널링 사용
리눅스 php-pecl-ssh2 설치

1 확인[ | ]

[root@zetawiki ~]# rpm -qa | grep php-pecl-ssh2
[root@zetawiki ~]# php -r "ssh2_tunnel();"
PHP Fatal error:  Call to undefined function ssh2_tunnel() in Command line code on line 1

Fatal error: Call to undefined function ssh2_tunnel() in Command line code on line 1
→ ssh2_tunnel 명령어를 인식하지 못함.
[root@zetawiki ~]# yum list php-pecl-ssh2
... (생략)
Error: No matching Packages to list
→ yum으로 설치 불가

2 epel-release 설치[ | ]

3 php-pecl-ssh2 설치[ | ]

[root@zetawiki ~]# yum install php-pecl-ssh2
... (생략)
===================================================================================================================================
 Package                            Arch                        Version                            Repository                 Size
===================================================================================================================================
Installing:
 php-pecl-ssh2                      x86_64                      0.11.0-7.el6                       epel                       31 k

Transaction Summary
===================================================================================================================================
Install       1 Package(s)

Total download size: 31 k
Installed size: 73 k
Is this ok [y/N]: y
... (생략)
Installed:
  php-pecl-ssh2.x86_64 0:0.11.0-7.el6                                                                                              

Complete!

4 확인 2[ | ]

[root@zetawiki ~]# rpm -qa | grep php-pecl-ssh2
php-pecl-ssh2-0.11.0-7.el6.x86_64
[root@zetawiki ~]# php -r "ssh2_tunnel();"
PHP Warning:  ssh2_tunnel() expects exactly 3 parameters, 0 given in Command line code on line 1

Warning: ssh2_tunnel() expects exactly 3 parameters, 0 given in Command line code on line 1
→ PHP 모듈이 ssh2_tunnel 함수를 인식하였다.
  • 웹에도 적용하려면 아파치를 재시작해야 한다.
[root@zetawiki ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

5 같이 보기[ | ]

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