Laravel 5.2:Process 类依赖于 proc_open,这在您的 PHP 安装中不可用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45419702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 16:24:58  来源:igfitidea点击:

Laravel 5.2: The Process class relies on proc_open, which is not available on your PHP installation

phplaravelcroncpanel

提问by Seunope

I use cron job to do some CRUD operation using laravel Task Scheduling. On localhost and on my Share-Hosting server it worked fine for months until recently I keep getting this error when I run cron job on my Share-Hosting server. I did not make any changes to the code on my Share-Hosting server.

我使用 cron 作业使用 laravel 任务调度来做一些 CRUD 操作。在 localhost 和我的 Share-Hosting 服务器上,它工作了好几个月,直到最近我在我的 Share-Hosting 服务器上运行 cron 作业时不断收到此错误。我没有对共享托管服务器上的代码进行任何更改。

[2017-07-14 09:16:02] production.ERROR: exception 'Symfony\Component\Process\Exception\RuntimeException' with message 'The Process class relies on proc_open, which is not available on your PHP installation.' in /home/xxx/xx/vendor/symfony/process/Process.php:144
Stack trace:

But on localhost it works fine. Based on my finding online I have tried the following.

但是在本地主机上它工作正常。根据我在网上的发现,我尝试了以下方法。

  1. Contacted my hosting company to remove proc_open form disable PHP functions.
  2. Hosting company provided custom php.ini file. I remove all disable_functions
  3. Share-Hosting Server was restarted and cache was cleared
  1. 联系我的托管公司删除 proc_open 表单禁用 PHP 功能。
  2. 托管公司提供自定义 php.ini 文件。我删除了所有 disable_functions
  3. 共享托管服务器已重新启动并清除缓存

None of this fixed the issue. I am not sure of what next to try because the same project works fine on different Share-Hosting Server.

这些都没有解决问题。我不确定接下来要尝试什么,因为同一个项目在不同的共享托管服务器上运行良好。

采纳答案by Seunope

After many weeks of trying to resolve this error. The following fixes worked

经过数周的尝试解决此错误。以下修复有效

  1. Upgrade project from Laravel 5.2 to 5.4
  2. On CPanel using "Select Php version" set PHP version to 7
  3. Or on CPanel using "MultiPHP Manager" set PHP version to ea-php70
  1. 将项目从 Laravel 5.2 升级到 5.4
  2. 在 CPanel 上使用“选择 PHP 版本”将PHP 版本设置为 7
  3. 或者在 CPanel 上使用“MultiPHP Manager”将 PHP 版本设置为ea-php70

Now, cron job runs smoothly. I hope this helps someone.

现在,cron 作业运行顺利。我希望这可以帮助别人。

回答by Bashirpour

Laravel 6 and higher (proc_open Error)

Laravel 6 及更高版本(proc_open 错误)

It is because of Flare error reporting service enabled in debug mode There is a workaround for this.

这是因为在调试模式下启用了 Flare 错误报告服务有一个解决方法。

Publish flare config file php artisan vendor:publish --tag=flare-config

发布耀斑配置文件 php artisan vendor:publish --tag=flare-config

and in config/flare.php

并在 config/flare.php

Set

'collect_git_information' => false 
'reporting' => [
     'anonymize_ips' => true,
     'collect_git_information' => false,
     'report_queries' => true,
     'maximum_number_of_collected_queries' => 200,
     'report_query_bindings' => true,
     'report_view_data' => true,
],

回答by reza jafari

For me removing cached version of config.php file solve problem(Laravel 6). go to bootstrap/cache/config.php and remove file. Also don't forget to change APP_URL to your domain address. PHP version should be as required by laravel version.

对我来说,删除缓存版本的 config.php 文件解决问题(Laravel 6)。转到 bootstrap/cache/config.php 并删除文件。另外不要忘记将 APP_URL 更改为您的域地址。PHP 版本应符合 Laravel 版本的要求。



for shared host if you can't change php.ini, you should use laravel 5.8.

对于共享主机,如果你不能更改 php.ini,你应该使用 laravel 5.8。

回答by Ali Sharifineyestani

When Flare error reporting service enabled in debug mode you'll see this error

在调试模式下启用 Flare 错误报告服务时,您将看到此错误

The solution is:

解决办法是:

Publish flare config file

发布耀斑配置文件

php artisan vendor:publish --tag=flare-config

in config/flare.php Set:

在 config/flare.php 中设置:

'reporting' => [
        'anonymize_ips' => true,
        'collect_git_information' => false,
        'report_queries' => true,
        'maximum_number_of_collected_queries' => 200,
        'report_query_bindings' => true,
        'report_view_data' => true,
    ],



'send_logs_as_events' => false,