简体   繁体   English

Laravel Artisan命令肥皂叫“Class'SoapClient'找不到”

[英]Laravel Artisan command for soap call “Class 'SoapClient' not found”

I have an artisan command where I do a soap call. 我有一个工匠命令,我在那里打肥皂。

So I use the SoapClient 所以我使用SoapClient

use SoapClient;

When I test run my command from an url like this: 当我测试从这样的URL运行我的命令时:

Route::get('test-command', function() {
    Artisan::call('updateRegisterLogs');
});

Everything works great! 一切都很棒!

Now when I try to run it with artisan on my linux server to test the command to create a cronjob I get the following error: 现在,当我尝试在我的linux服务器上运行artisan来测试命令来创建一个cronjob时,我收到以下错误:

[Symfony\\Component\\Debug\\Exception\\FatalThrowableError] [Symfony的\\元器件\\调试\\异常\\ FatalThrowableError]

Class 'SoapClient' not found 找不到“SoapClient”类

The weird thing is I even get this error when I try a simple php artisan to see a list of all my commands. 奇怪的是,当我尝试一个简单的php artisan看到我所有命令的列表时,我甚至得到了这个错误。

Why does my artisan break from this? 为什么我的工匠会因此而破产? My code works fine but artisan doesn't. 我的代码工作正常,但工匠没有。

The PHP version and also the CLI ini file could be different from the web one and when running command with artisan you are using the php cli. PHP版本和CLI ini文件可能与Web文件不同,当使用artisan运行命令时,您使用的是php cli。 Check with php -r "echo phpinfo();" 检查php -r "echo phpinfo();" If your php cli has soap enabled. 如果你的php cli启用了soap。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM