简体   繁体   中英

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

use SoapClient;

When I test run my command from an url like this:

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:

[Symfony\\Component\\Debug\\Exception\\FatalThrowableError]

Class 'SoapClient' not found

The weird thing is I even get this error when I try a simple php artisan to see a list of all my commands.

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. Check with php -r "echo phpinfo();" If your php cli has soap enabled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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