PHP 在 Windows 机器上安装 SSH2
我正在尝试在 上安装 thisWindows+Apache
机器.文档说 SSH2 需要 OpenSSL
和 libssh2
库.我在 php.ini
文件中添加了这几行:
I am trying to install this on a Windows+Apache
machine.
Documentation says that SSH2 requires the OpenSSL
and libssh2
libraries.
I have added this lines in my php.ini
file:
extension=php_openssl.dll
extension=php_ssh2.dll
并重新启动 Apache,但它仍然无法正常工作(致命错误:调用未定义的函数 ssh2_connect()
).
and restarted Apache but it still not working (Fatal error: Call to undefined function ssh2_connect()
).
谁能解释一下如何安装这个服务?
Can anyone explain me how to install this service?
我是这样做的:
从此位置下载了 Win32 SSH2 PECL 扩展程序(选择合适的版本);
提取档案的内容并:
- 将
php_ssh2.dll
和php_ssh2.pdb
文件放在ext
文件夹中(例如C:\php\ext
代码>); - 将
libssh2.dll
文件复制到C:\Windows\system32
和(如果你有 Win64)C:\Windows\SysWOW64
文件夹(s);
- placed
php_ssh2.dll
andphp_ssh2.pdb
files in theext
folder (e.g.C:\php\ext
); - copied
libssh2.dll
file toC:\Windows\system32
and (if you got Win64)C:\Windows\SysWOW64
folder(s);
运行以下命令注册DLL:
Run the following command to register the DLL:
C:\> regsvr32 libssh2.dll
重新启动 Apache.
Restarted Apache.
最后说明
如果您有 PHP x64,则必须查找 SSH2 库/DLL 的 x64 版本.该站点提供了一些用于 PHP 的 Win64 编译库,请先在这里尝试.
If you got PHP x64, you have to lookup for the x64 version of the SSH2 library / DLLs. This site offers some Win64 compiled libraries for PHP, try here first.
希望这会有所帮助.