15

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.

[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

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.

Mahdi Bashirpour
  • 17,147
  • 12
  • 117
  • 144
Seunope
  • 4,784
  • 2
  • 24
  • 30

6 Answers6

12

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

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

Seunope
  • 4,784
  • 2
  • 24
  • 30
  • What version of Laravel are you using? – Seunope Feb 18 '20 at 14:33
  • 2
    laravel 6 is my version – Hamidreza Ghanbari Feb 26 '20 at 06:28
  • Not working for me, Laravel Framework 6.18.2 and PHP version ea-php73 – Shuvo Joseph Apr 02 '20 at 14:47
  • hi, could you show me the command please. I can't get the jobs to work in my cpanel. I also have Laravel 7 and Cpanel and I tested it this way: /opt/cpanel/ea-php72/root/usr/bin/php /home/brooklyn/Sistema/artisan schedule:run >> /dev/null 2>&1 – maraet Mar 25 '21 at 12:55
  • This fix served to me. I'm running Laravel 9 with PHP 8.1. PHP version must match both in "Select Php version" and "MultiPHP Manager". – JPMarichal Dec 06 '22 at 08:41
  • I had the same error and it's because I forgot to change the cron command from `/usr/local/bin/ea-php74 /home/xxx/laravel/current/artisan schedule:run > /dev/null 2>&1` to `/usr/local/bin/ea-php80 /home/xxx/laravel/current/artisan schedule:run > /dev/null 2>&1` when I upgrade the php version on "MultiPHP Manager". Hope it will help someone. – Petitemo Mar 28 '23 at 07:05
12

Laravel 6 and higher (proc_open Error)

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

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

and in 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,
],
Community
  • 1
  • 1
Mahdi Bashirpour
  • 17,147
  • 12
  • 117
  • 144
9

You can use this at your own risk:

/usr/local/bin/php -d "disable_functions=" /home/didappir/public_html/api/artisan schedule:run > /dev/null 2>&1 
rfay
  • 9,963
  • 1
  • 47
  • 89
Hadi Note
  • 1,386
  • 17
  • 16
3

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

The solution is:

Publish flare config file

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

in config/flare.php Set:

'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,
Ali Sharifi Neyestani
  • 4,162
  • 1
  • 14
  • 22
2

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.


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

reza jafari
  • 1,228
  • 13
  • 14
0

enter image description here

if it is disabled you cannot run it
use phpinfo() to find out if it's disabled