Categories
Fixing Stuff Laravel Samuel

Fixing Cron Job Error on Laravel 5.1 application

Background: We updated to php from 5.2 to 5.6 and our cron job starting firing an error. The steps taken to fix this are:

1.) Verify that argc_argv is set to =”On” in the default server php.ini file.

2.) Modify the cron job command:

original: php /home/username/path-to-laravel/artisan schedule:run >> /dev/null 2>&1

updated: php -d register_argc_argv=On /home/username/path-to-laravel/artisan schedule:run >> /dev/null 2>&1

——Update 11/30/2016——

We had issues with this cron again and the way to fix things was the following:

1.) login to WHM and navigate to MultiphpINI Editor > Editor Mode
2.) Select the current system default version of PHP (if not sure navigate to the Multiphp Manager page and it displays the system default at the top)
3.) On Editor Mode page navigate to Line 654 and set register_argc_argv = On

Save the file and your done.

Useful Testing info:

In this process I needed to figure out how to run an individual command from the laravel scheduler…. since the scheduler was set to only run the command I needed once per day I just wanted to manually run that command. To Do this we open up the actual command file:

app > console > commands and then find the command file you want. Then open the file up and find the “protected name”

command to run on the server:
php artisan 'protected name'. *note include the quotes when you copy this into your SSH terminal.