# Error when running cron jobs

**URL:** <https://forum.mautic.org/t/error-when-running-cron-jobs/2075>\
**Category:** Product Support\
**Created:** [July 24, 2015, 5:11am UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075 "2015-07-24T05:11:39Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![wootme](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wootme](https://forum.mautic.org/u/wootme)\
**Post date:** [July 24, 2015, 5:11am UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/1 "2015-07-24T05:11:39Z")

</div>

Hi,  
  
  
  
Server - Shared host  
  
version - 1.1.3  
  
  
  
Adding cron jobs I am getting error :

Code:

[23-Jul-2015 18:04:01 UTC] PHP Notice: Undefined index: argv in /home/xxx/public\_html/mautic/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 57 [23-Jul-2015 18:04:01 UTC] PHP Warning: array\_shift() expects parameter 1 to be array, null given in /home/xxx/public\_html/mautic/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 61 [23-Jul-2015 18:04:01 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/xxx/public\_html/mautic/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 287

  
Any idea?

---

<div class="post-metadata">

**Author:** ![wootme](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wootme](https://forum.mautic.org/u/wootme)\
**Post date:** [July 24, 2015, 5:11am UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/2 "2015-07-24T05:11:39Z")

</div>

Hi,

Server - Shared host  
version - 1.1.3

Adding cron jobs I am getting error : `[23-Jul-2015 18:04:01 UTC] PHP Notice: Undefined index: argv in /home/xxx/public_html/mautic/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 57
[23-Jul-2015 18:04:01 UTC] PHP Warning: array_shift() expects parameter 1 to be array, null given in /home/xxx/public_html/mautic/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 61
[23-Jul-2015 18:04:01 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/xxx/public_html/mautic/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 287`

Any idea?

---

<div class="post-metadata">

**Author:** ![wootme](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wootme](https://forum.mautic.org/u/wootme)\
**Post date:** [July 24, 2015, 6:39am UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/3 "2015-07-24T06:39:57Z")

</div>

New error:  
[24-Jul-2015 07:38:02 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/xxx/public\_html/mautic/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 287

---

<div class="post-metadata">

**Author:** ![wootme](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wootme](https://forum.mautic.org/u/wootme)\
**Post date:** [July 24, 2015, 7:30am UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/4 "2015-07-24T07:30:45Z")

</div>

[24-Jul-2015 08:00:01 UTC] PHP Warning: array\_shift() expects parameter 1 to be array, null given in /home/xxx/public\_html/mautic/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 61

---

<div class="post-metadata">

**Author:** ![chad.windnagle](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@chad.windnagle](https://forum.mautic.org/u/chad.windnagle)\
**Post date:** [July 24, 2015, 12:37pm UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/5 "2015-07-24T12:37:17Z")

</div>

I hate to just google up an answer but it looks like this could be it:

[http://stackoverflow.com/questions/14108592/composer-not-installing-uncaught-exception-errorexception-with-message-undefi](http://stackoverflow.com/questions/14108592/composer-not-installing-uncaught-exception-errorexception-with-message-undefi)

Any way to check the php.ini?

---

<div class="post-metadata">

**Author:** ![wootme](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wootme](https://forum.mautic.org/u/wootme)\
**Post date:** [July 24, 2015, 2:27pm UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/6 "2015-07-24T14:27:04Z")

</div>

[quote=2281:chad.windnagle]I hate to just google up an answer but it looks like this could be it:

[http://stackoverflow.com/questions/14108592/composer-not-installing-uncaught-exception-errorexception-with-message-undefi](http://stackoverflow.com/questions/14108592/composer-not-installing-uncaught-exception-errorexception-with-message-undefi)

Any way to check the php.ini?[/quote]

I did check it, not working. I just can’t seem to trigger any cron on this hosting, during testing lead list update did get trigger but I am unsure how.  
Looking in cron job email I get this:

[code]Mautic version 1.1.3 - app/prod

Usage:  
[options] command [arguments]

Options:  
–help -h Display this help message  
–quiet -q Do not output any message  
–verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug  
–version -V Display this application version  
–ansi Force ANSI output  
–no-ansi Disable ANSI output  
–no-interaction -n Do not ask any interactive question  
–shell -s Launch the shell.  
–process-isolation Launch commands from shell as a separate process.  
–env -e The Environment name.  
–no-debug Switches off debug mode.

Available commands:  
help Displays help for a command  
list Lists commands  
assets  
assets:install Installs bundles web assets under a public web directory  
bazinga  
bazinga:oauth-server:clean Clean expired tokens  
cache  
cache:clear Clears the cache  
cache:warmup Warms up an empty cache  
config  
config:debug Dumps the current configuration for an extension  
config:dump-reference Dumps the default configuration for an extension  
container  
container:debug Displays current services for an application  
debug  
debug:swiftmailer Displays current mailers for an application  
doctrine  
doctrine:cache:clear-metadata Clears all metadata cache for an entity manager  
doctrine:cache:clear-query Clears all query cache for an entity manager  
doctrine:cache:clear-result Clears result cache for an entity manager  
doctrine:database:create Creates the configured databases  
doctrine:database:drop Drops the configured databases  
doctrine:ensure-production-settings Verify that Doctrine is properly configured for a production environment.  
doctrine:fixtures:load Load data fixtures to your database.  
doctrine:generate:entities Generates entity classes and method stubs from your mapping information  
doctrine:mapping:convert Convert mapping information between supported formats.  
doctrine:mapping:import Imports mapping information from an existing database  
doctrine:mapping:info  
doctrine:migrations:diff Generate a migration by comparing your current database to your mapping information.  
doctrine:migrations:execute Execute a single migration version up or down manually.  
doctrine:migrations:generate Generate a blank migration class.  
doctrine:migrations:latest Outputs the latest version number  
doctrine:migrations:migrate Execute a migration to a specified version or the latest available version.  
doctrine:migrations:status View the status of a set of migrations.  
doctrine:migrations:version Manually add and delete migration versions from the version table.  
doctrine:query:dql Executes arbitrary DQL directly from the command line.  
doctrine:query:sql Executes arbitrary SQL directly from the command line.  
doctrine:schema:create Executes (or dumps) the SQL needed to generate the database schema  
doctrine:schema:drop Executes (or dumps) the SQL needed to drop the current database schema  
doctrine:schema:update Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata.  
doctrine:schema:validate Validate the mapping files.  
fos  
fos:oauth-server:clean Clean expired tokens  
generate  
generate:doctrine:entities Generates entity classes and method stubs from your mapping information  
init  
init:acl Mounts ACL tables in the database  
mautic  
mautic:assets:generate Combines and minifies asset files from each bundle into single production files  
mautic:campaign:trigger Trigger timed events for published campaigns.  
mautic:campaigns:rebuild Rebuild campaigns based on lead lists.  
mautic:campaigns:trigger Trigger timed events for published campaigns.  
mautic:campaigns:update Rebuild campaigns based on lead lists.  
mautic:email:process Processes SwiftMail’s mail queue  
mautic:emails:process Processes SwiftMail’s mail queue  
mautic:install:data Installs Mautic with sample data  
mautic:leadlists:rebuild Update leads in smart lists based on new lead data.  
mautic:leadlists:update Update leads in smart lists based on new lead data.  
mautic:lists:rebuild Update leads in smart lists based on new lead data.  
mautic:lists:update Update leads in smart lists based on new lead data.  
mautic:process:email Processes SwiftMail’s mail queue  
mautic:process:emails Processes SwiftMail’s mail queue  
mautic:rebuild:campaigns Rebuild campaigns based on lead lists.  
mautic:rebuild:leadlists Update leads in smart lists based on new lead data.  
mautic:rebuild:lists Update leads in smart lists based on new lead data.  
mautic:send:email Processes SwiftMail’s mail queue  
mautic:send:emails Processes SwiftMail’s mail queue  
mautic:transifex:pull Fetches translations for Mautic from Transifex  
mautic:transifex:push Pushes Mautic translation resources to Transifex  
mautic:translation:createconfig Create config.php files for translations  
mautic:translation:debug Displays translation messages informations  
mautic:trigger:campaign Trigger timed events for published campaigns.  
mautic:trigger:campaigns Trigger timed events for published campaigns.  
mautic:update:apply Updates the Mautic application  
mautic:update:campaigns Rebuild campaigns based on lead lists.  
mautic:update:find Fetches updates for Mautic  
mautic:update:leadlists Update leads in smart lists based on new lead data.  
mautic:update:lists Update leads in smart lists based on new lead data.  
oneup  
oneup:uploader:clear-chunks Clear chunks according to the max-age you defined in your configuration.  
oneup:uploader:clear-orphans Clear orphaned uploads according to the max-age you defined in your configuration.  
orm  
orm:convert:mapping Convert mapping information between supported formats.  
router  
router:debug Displays current routes for an application  
router:dump-apache Dumps all routes as Apache rewrite rules  
router:match Helps debug routes by simulating a path info match  
swiftmailer  
swiftmailer:debug Displays current mailers for an application  
swiftmailer:email:send Send simple email message  
swiftmailer:spool:send Sends emails from the spool  
translation  
translation:debug Displays translation messages informations  
translation:update Updates the translation file  
yaml  
yaml:lint Lints a file and outputs encountered errors  
X-Powered-By: PHP/5.3.29  
Set-Cookie: “removed by me”; path=/  
Content-type: text/html[/code]

Is this correct output of a cron job running?

The log in mautic/app/logs/error.log shows this:

```auto
Invalid argument supplied for foreach() in /home/xxx/public_html/mautic/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 287
```

My host is SSL enabled and I am re-directing using .htaccess rule, could it be that I need to set mautic installation as [http://my.mautic](http://my.mautic) instead of [https://my.mautic](https://my.mautic) (currently it’s setup as this)

---

<div class="post-metadata">

**Author:** ![chad.windnagle](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@chad.windnagle](https://forum.mautic.org/u/chad.windnagle)\
**Post date:** [July 24, 2015, 2:31pm UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/7 "2015-07-24T14:31:09Z")

</div>

So if you do:

```auto
php app/console
```

That will just be an info page with no command sent to it. To do a command you actually will pass a second value:

```auto
php app/console mautic:leadlists:update --env=prod
```

That should actually be a command running. Is that what you have in your cron configuration?

---

<div class="post-metadata">

**Author:** ![wootme](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wootme](https://forum.mautic.org/u/wootme)\
**Post date:** [July 24, 2015, 2:33pm UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/8 "2015-07-24T14:33:23Z")

</div>

my cron job is this

```auto
php /home/xxx/public_html/mautic/app/console mautic:lists:update --env=prod
```

---

<div class="post-metadata">

**Author:** ![davidjb](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@davidjb](https://forum.mautic.org/u/davidjb)\
**Post date:** [July 28, 2015, 1:33pm UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/9 "2015-07-28T13:33:12Z")

</div>

I was having exactly the same errors with my shared hosting. Had to change my cron to:

/usr/bin/php-cli -q /path/to/mautic/app/console mautic:leadlists:update --env=prod

and it solved the problem. This fix was mentioned elsewhere in the forums but can’t remember where.

---

<div class="post-metadata">

**Author:** ![dobesv](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@dobesv](https://forum.mautic.org/u/dobesv)\
**Post date:** [August 18, 2015, 4:55am UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/10 "2015-08-18T04:55:49Z")

</div>

Yes php-cli worked for me on bluehost, whereas the regular php command doesn’t work there. Might be the same for you. I put in a change request for this in the docs to help people out.

---

<div class="post-metadata">

**Author:** ![chad.windnagle](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@chad.windnagle](https://forum.mautic.org/u/chad.windnagle)\
**Post date:** [August 18, 2015, 11:50am UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/11 "2015-08-18T11:50:42Z")

</div>

Problem is that php-cli is not universal. All hosting companies have different ways of using their command line version of php.

---

<div class="post-metadata">

**Author:** ![rockhold](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rockhold](https://forum.mautic.org/u/rockhold)\
**Post date:** [January 13, 2016, 6:00pm UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/12 "2016-01-13T18:00:17Z")

</div>

[quote]

I was having exactly the same errors with my shared hosting. Had to change my cron to:

/usr/bin/php-cli -q /path/to/mautic/app/console mautic:leadlists:update --env=prod

and it solved the problem. This fix was mentioned elsewhere in the forums but can’t remember where.[/quote]  
@davidjb thanks for your fixture…this helped me to solve the above error which was created today however, my host, script developer & I were working for almost 4 days continuously but can’t solve cron job issue.  
The php cli helped a lot…  
I used the above code with public\_html instead of /path/to and it worked successfully.  
"/usr/bin/php-cli -q /home/cpaneluser/public\_html/sitename.com/script  
Although it was related to laravel framework.

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [February 2, 2020, 10:58pm UTC](https://forum.mautic.org/t/error-when-running-cron-jobs/2075/13 "2020-02-02T22:58:41Z")

</div>


