dou12754 2017-01-11 13:05
浏览 240

未找到类从Supervisord调用Laravel脚本

I'm using Laravel workers to execute some background tasks. When I invoke the worker using 'php artisan queue:work', it works without any problem

But when I add the same command to supervisord in CentOS, using the following congifuration:

[program:laravel-worker]

process_name=%(program_name)s_%(process_num)02d command=php

/var/www/html/laravel/artisan queue:work

autostart=true

autorestart=true

user=root

numprocs=8

redirect_stderr=true

stdout_logfile=/var/www/html/laravel/worker.log

I get the following error:

PHP Fatal error: Class 'SoapClient' not found in /var/www/html/laravel/app/External/library/RegistrationServi‌​ce.php on line 169

[Symfony\Component\Debug\Exception\FatalErrorException] Class 'SoapClient' not found

The jobs are not executed complaining that SoapClient is not found (although it is installed). The SoapClient class is inherited by a plain PHP class that I load externally.

Note that I can use this class via the controller or the jobs when executed from command line without any problem, only in supervisord it's giving me the error message. To make things more weird, it happens only with one job that utilizes this external class, it doesn't happen with jobs that utilize Laravel's classes (controllers, events, etc...) only.

  • 写回答

2条回答 默认 最新

  • duankange2433 2017-01-11 14:23
    关注

    For SoapClient in Laravel 5.2:

    1. add 'SoapClient' => SoapClient::class, in Config/app.php

    2. add use SoapClient; in your controller.

    3. use soapClinet in your function: new SoapClient('...');

    评论

报告相同问题?

悬赏问题

  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀