php - I'm including this BurakBoz/CyberLink Library in my example project but it displays error for the sub classes included
问题描述
I'm trying to use a pre-built library to use Cyberpanel which is an opensource web hosting control panel but when I use it in my application it displays me error of Class not found, I've run command "composer require burakboz/cyberlink:dev-master"
but it didn't help as well.
Error: Fatal error: Uncaught Error: Class 'phpseclib\Net\SSH2' not found in
D:\PHP\xamp\htdocs\localphp\bornbee\CyberLink.php:42 Stack trace: #0
D:\PHP\xamp\htdocs\localphp\bornbee\index.php(12): BurakBoz\CyberLink-
>__construct('127.0.0.1', 'root', 'TopSecretPasswo...', NULL, 22, 10, false)
#1 {main} thrown in D:\PHP\xamp\htdocs\localphp\bornbee\CyberLink.php on line 42
index.php
(My example class)
<?php
require("CyberLink.php");
// If you need public key auth on ssh connection provide private key string to $key parameter otherwise it should be null.
// $enableSecureFTP parameter should be true for using setCustomSSL method.
// If you don't need this don't set it true.
$ip = "127.0.0.1";
$user = "root"; // use only root user
$password = "TopSecretPassword"; // root password
$port = 22; // ssh port
$timeout = 20; // connection timeout
$enableSecureFTP = false; // set it true if you use $cyberlink->setCustomSSL() method.
$cyberlink = new \BurakBoz\CyberLink($ip, $user, $password, $key = null, $port = 22, $timeout = 10, $enableSecureFTP = false);
$phpVersion = "7.3";
$owner = "admin";
$package = "Default";
try
{
if($cyberlink->createWebsite("merhaba.com", "admin@siteowner.com", $package, $owner, $phpVersion))
{
echo "Host created.";
}
else
{
echo "Error: " . $cyberlink->getLastMessage();
}
}
catch (Exception $e)
{
echo "Error: " . $e->getMessage();
}
?>
CyberLink Library https://github.com/BurakBoz/CyberLink/tree/master/src
解决方案
The problem was, I didn't include the autoloader.php in my index.php file as it demands the autoloader.php that has been created using composer command, which was needed alternately without requiring each php library.
require_once 'vendor/autoload.php';
推荐阅读
- google-cloud-platform - 权限 GCS 存储桶
- powershell - 如何将任何密钥传递给powershell Start-Process msiexec.exe 命令
- python - 检查 2 个 CSV 中的相同 ID 是否具有不同的名称
- typescript - 运算符 '*=' 不能应用于类型 'number | bigint' 和 '数字'。",
- rest - 用于公共和私有资源的 Rest API
- typescript - 将 typescript 接口转换为 json 对象
- javascript - 为什么我们在倒计时应用程序中使用余数?
- arrays - Flutter:将计数器添加到重新运行的分页列表
- javascript - 如何将变量从 Python Flask 传输到 JavaScript?
- python - Django通过外键链接2个表