嘿伙计们,我收到一个错误“错误 [PDOException] 找不到驱动程序”,就像我标题上的描述一样。有谁知道如何修复它??
这是我的 .env
APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:CZRXQSmW+gkqzEV0NzRZDtxmsUjoHdk3ZuYqkIh3rgw=
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=secret
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=beanstalkd
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
还有我的代码
这个是队列一
namespace Automation\Jobs;
use Automation\Models\UserLog;
use Automation\Models\User;
use Automation\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class SendReminderEmail extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
protected $user;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($id)
{
$this->user = $id;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
echo "start";
$userlog = new UserLog;
$userlog->email = $this->user."@test.com";
$userlog->admin = $this->user;
$userlog->description = $this->user;
$userlog->created = date("Y-m-d H:i:s");
$userlog->save();
$sleep = mt_rand(1, 10);
sleep($sleep);
$userlog = new UserLog;
$userlog->email = $this->user."@test.com";
$userlog->admin = $this->user;
$userlog->description = $this->user;
$userlog->created = date("Y-m-d H:i:s");
$userlog->save();
echo "end";
}
}
我只是用这样的功能调用
$this->dispatch(new SendReminderEmail(7));
我在 ubuntu 服务器上工作,当我使用 php artisan queue:listen on command line 时出现错误