php 调用未定义的函数 ssh2_connect()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18979144/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 18:36:32  来源:igfitidea点击:

Call to undefined function ssh2_connect()

php

提问by user2807431

$connection = ssh2_connect($SFTP_SERVER, 22);
ssh2_auth_password($connection,$SFTP_USERNAME,$SFTP_PASSWORD);
$sftp = ssh2_sftp($connection);

Fatal error: Call to undefined function ssh2_connect() in /var/www/html/beta/0sftp.php on line 33

致命错误:在第 33 行调用 /var/www/html/beta/0sftp.php 中未定义的函数 ssh2_connect()

my system is CentOS 6.4 all the required extensions is installed but I don't know how to verify.

我的系统是 CentOS 6.4 安装了所有必需的扩展,但我不知道如何验证。

回答by Moshe Zino

try to run the command :

尝试运行命令:

yum install php-pecl-ssh2

yum 安装 php-pecl-ssh2

回答by JP Dippenaar

For whatever it is worth, I tested the installation from the command line

不管它值多少钱,我都从命令行测试了安装

php -i | grep ssh

and it was OK, but it did not work in a web page; took me a couple of minutes to remember I have to re-start Apache after installation :)

还可以,但在网页中不起作用;我花了几分钟才记住我必须在安装后重新启动 Apache :)