windows7下安装php的php-ssh2扩展教程(启动php报错:libssh2.dll 丢失)

WBOY
Release: 2016-06-23 13:06:02
Original
1186 people have browsed it

启动php报错:libssh2.dll 丢失。

解决方法:安装php-ssh2扩展。

windows7下安装php的php-ssh2扩展教程

因为想做一个往测试服务器传文件的需求,看到PHP支持ssh操作,所以整理了下安装过程,与大家分享下。

安装步骤

1. 下载 phpextension ssh2

下载地址 http://windows.php.net/downloads/pecl/releases/ssh2/0.12/

根据自己PHP的版本去下载,我使用的是线程安全的,所以下载的是php_ssh2-0.12-5.4-ts-vc9-x86.zip

2. 解压完后,会有三个文件,libssh2.dll、php_ssh.dll、php_ssh2.pdb。

3. 将 php_ssh.dll、php_ssh2.pdb 放到你的 php 扩展目录下 php/ext/ 下。

4. 将libssh2.dll 复制到 c:/windows/system32 和 c:/windows/syswow64 各一份

5. php.ini中加入 extension=php_ssh2.dll

6. 重启apache,即可使用php执行ssh连接操作了。

查看phpinfo(),是否有显示php_ssh2扩展加载成功。

PHP测试代码

复制代码代码如下:

$connection = ssh2_connect('192.168.255.128', 22);ssh2_auth_password($connection, 'root', '123456');ssh2_scp_send($connection, 'd:/tmp/test.txt', '/tmp/test.txt', 0644);
Copy after login

+

=

=

=

=

+

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template