我正试图在Laravel 6项目中实现控制台/quickbooks-php。如果我从控制器调用队列操作,它就能正常工作。但是现在我想用Laravel的工作来完成它。这就是我得到错误的地方:
我收到这个错误:
QuickBooks_Loader::load(): Failed opening required '/var/www/html/buyforme/b4m-aportal-v2/vendor/consolibyte/quickbooks/QuickBooks/Driver/.php' (include_path='.:/usr/share/php:/var/www/html/buyforme/b4m-aportal-v2/vendor/consolibyte/quickbooks')它所指的这个特定行在Loader.php中:
if (QUICKBOOKS_LOADER_REQUIREONCE)
{
require_once QUICKBOOKS_BASEDIR . $file;
}我记录了QUICKBOOKS_BASEDIR . $file,它创建的路径是正确的,文件就在那里。权限也是有效的。
作业:
类AddInventoryIntoQB实现ShouldQueue {使用Dispatchable,InteractsWithQueue,Queueable,SerializesModels;
/**
* Item object.
*/
protected $item;
/**
* @var LaravelQbd
*/
protected $QBD;
/**
* Create a new job instance.
*
* @param Item $item
*/
public function __construct(Item $item)
{
$this->QBD = new LaravelQbd;
$this->item = $item;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$this->QBD->enqueue(QUICKBOOKS_ADD_INVENTORYITEM, $this->item);
}LaravelQbd:
/**
* User Configuration File Array
*/
protected $dsn;
protected $config;
protected $map = [];
public function __construct()
{
$this->config = config('quickbooks');
$this->dsn = $this->config['qb_dsn'];
}
public function enqueue($action, $object, $priority = 0, $extra = null, $user = null)
{
$Queue = new \QuickBooks_WebConnector_Queue($this->dsn);
return $Queue->enqueue($action, $object, $priority, $extra, $user);
}只有当我不把它作为一份工作来运行的时候,它才能起作用。我做错什么了?
发布于 2020-01-24 18:48:05
造成此错误的最可能原因是:
'/var/www/html/buyforme/b4m-aportal-v2/vendor/consolibyte/quickbooks/QuickBooks/Driver/.php‘
QuickBooks_Loader::load():打开失败
格式错误或空的dsn连接字符串。也就是说,代码正在寻找数据库驱动程序,并且您指定要使用的数据库驱动程序不存在。
在此代码中:
public function __construct()
{
$this->config = config('quickbooks');
$this->dsn = $this->config['qb_dsn'];
}你是否:
qb_dsn甚至设置为值吗?你能粘贴你的dsn字符串(用密码屏蔽/删除)吗?
https://stackoverflow.com/questions/59892144
复制相似问题