PHP can not perform soap call from laravel command

不打扰是莪最后的温柔 提交于 2019-12-11 17:19:05

问题


I have made a Laravel command that I try to run with a cronjob every minute.

In the command there is some logic that does a soap call. When I run the command through a route that I created everything works fine.

like this:

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

Now when I try to do the same thing in my command on the server like this:

php artisan updateRegisterLogs

I get the following error:

Class 'SoapClient' not found

Now I searched on the internet and in my php.ini I removed the ; before extension=php_soap.dll and before extension=php_openssl.dll and I've restarted my apache and unfortunately I get the same error.

I am now sure what is going wrong here since my code works but not when executed with artian.


回答1:


Usually php has various php.ini configuration files, typically located on paths like, /etc/php/7.2/cli/php.ini or /etc/php/7.2/fpm/php.ini so from the problem you are having my guess is that you have uncommented the extension on one of those config files but not the cli path one.

If you have for example the application being served using nginx and phpfpm the php.ini file that will determine what modules are enabled when executing php for those requests will be the one located at /etc/php/7.2/fpm/php.ini. When you execute artisan commands the "selected" config file is the one at /etc/php/7.2/cli/php.init



来源:https://stackoverflow.com/questions/55572708/php-can-not-perform-soap-call-from-laravel-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!