PHP无法从laravel命令执行soap调用 [英] PHP can not perform soap call from laravel command

查看:300
本文介绍了PHP无法从laravel命令执行soap调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发出了Laravel命令,尝试每分钟运行一次cronjob.

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

在命令中,有一些逻辑可以进行soap调用.当我通过创建的路由运行命令时,一切正常.

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.

像这样:

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

我收到以下错误:

未找到"SoapClient"类

Class 'SoapClient' not found

现在我在互联网上搜索了,在php.ini中,我删除了extension=php_soap.dll之前和extension=php_openssl.dll之前的;,但是我重新启动了Apache,不幸的是我遇到了同样的错误.

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.

我现在可以确定这里出了什么问题,因为我的代码可以正常工作,但在与artian一起执行时却没有.

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

推荐答案

通常php具有各种php.ini配置文件,通常位于/etc/php/7.2/cli/php.ini/etc/php/7.2/fpm/php.ini之类的路径上,因此从这个问题出发,您的猜测是您已取消注释其中一个配置文件的扩展名,但未注释cli路径之一.

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.

例如,如果您有使用nginx和phpfpm服务的应用程序,则php.ini文件将位于/etc/php/7.2/fpm/php.ini,该文件将确定在为那些请求执行php时启用了哪些模块.当您执行artisan命令时,选择的"配置文件就是/etc/php/7.2/cli/php.init

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

这篇关于PHP无法从laravel命令执行soap调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆