【发布时间】:2023-04-04 07:55:01
【问题描述】:
我正在尝试使用 phpseclib 在我的服务器上运行一些 ssh 命令。尝试以下操作,我得到 Class 'Net_SSH2' not found in.... 这似乎表明 phpseclib 未正确加载,但回显显示包含正在工作。
我在这里做错了什么?
我的php
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
$thepath = $_SERVER['DOCUMENT_ROOT']. '/inc/phpseclib/Net/SSH2.php';
echo '<strong>Full include path:</strong> '. $thepath;
include ($thepath);
$included_files = get_included_files();
foreach ($included_files as $filename) {
echo "<br><strong>Included file:</strong>$filename";
}
$ssh = new Net_SSH2('xx.xx.x.xx.x'); // server's ip address
if (!$ssh->login('username', 'password')) { // filled in correctly
exit('Login Failed');
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>
Done.
输出
Full include path: /var/chroot/home/content/08/555555555/html/inc/phpseclib/Net/SSH2.php
Included file:/home/content/08/555555555/html/TeamBoard/deploy.php
Included file:/home/content/08/555555555/html/inc/phpseclib/Net/SSH2.php
Fatal error: Class 'Net_SSH2' not found in /home/content/08/555555555/html/TeamBoard/deploy.php on line 25
【问题讨论】: