简体   繁体   English

SSH2 PHP扩展

[英]SSH2 PHP Extension

I have been trying for a while to get the SSH 2 extension for php installed on my CentOS 5.6 x64 server. 我已经尝试了一段时间,以在我的CentOS 5.6 x64服​​务器上安装php的SSH 2扩展。 I started the server from scratch and here are the steps I have taken 我从头开始启动服务器,这是我已采取的步骤

  1. install and configure APF 安装和配置APF
  2. install apache 安装Apache
  3. install php 安装PHP
  4. install mysql 安装mysql
  5. add epel repository 添加epel资料库
  6. install php-pear so I can use pecl 安装php-pear,这样我就可以使用pecl
  7. run yum install libssh2-devel 运行yum install libssh2-devel
  8. run pecl install ssh2-beta 运行pecl install ssh2-beta
  9. echo extension=ssh2.so>>/etc/php.ini (There were a few extra things in there such as installing phpMyadmin and wordpress) echo extension = ssh2.so >> / etc / php.ini(其中还有一些额外的东西,例如安装phpMyadmin和wordpress)

After this I run php -m to see the php modules and ssh2 is not listed. 在此之后,我运行php -m来查看php模块,并且未列出ssh​​2。 I have been searching forever for tutorials and have found a few but from what I can see I have done everything correctly. 我一直在寻找教程,并找到了一些,但是从我的观察中我可以正确地完成所有工作。 Can anyone see where I am going wrong. 谁能看到我要去哪里错了。 I can provide any config files you may need. 我可以提供您可能需要的任何配置文件。 Also I have hear about phpseclib and was wondering if this would be an easier/better route? 我也听说过phpseclib,并且想知道这是否是更容易/更好的途径? Any help would be greatly appreciated! 任何帮助将不胜感激!

You could maybe try phpseclib, a pure PHP SFTP implementation , instead. 您也许可以尝试phpseclib,它是纯PHP SFTP实现 eg. 例如。

<?php
include('Net/SFTP.php');

$sftp = new Net_SFTP('www.domain.tld');
if (!$sftp->login('username', 'password')) {
    exit('Login Failed');
}

echo $sftp->pwd() . "\r\n";
$sftp->put('filename.ext', 'hello, world!');
print_r($sftp->nlist());
?>

Make sure /etc/php.ini is actually used. 确保/etc/php.ini被实际使用。 check php --info output to see the used ini file(s) 检查php --info输出以查看使用的ini文件

At least on debian the path would be /etc/php5/cli/php.ini 至少在debian上,路径为/etc/php5/cli/php.ini

也许没有区别,但是如果还没有这样,请尝试:

extension="ssh2.so"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM