After ver 2.1 no archive.php Cron tasks


#1

I’m hopeless after numerous hours/ days trying to resolve next issue.
After updating to ver 2.1, no matter what, I cannot archive either by running a cron job or externally calling archive.php.
No cron jobs means no archiving and most importantly no mails sent.
I’ve gone through triyng many versions (and betas), now being at 2.2.0-b18.
Googled and also checked all relative threads on this forum.
I have no other remedies left to rectify this problem of an otherwise truly excellent piece of work.
Regards

Following is what I’m getting when trying to archive calling archive.php.

INFO [2014-04-10 15:51:29] [14273] ---------------------------

INFO [2014-04-10 15:51:29] [14273] INIT

INFO [2014-04-10 15:51:29] [14273] Piwik is installed at: http://www.mySite.com/piwik/index.php

INFO [2014-04-10 15:51:29] [14273] Running Piwik 2.2.0-b18 as Super User: justxxxxnSU

INFO Piwik\CronArchiveFatalException[2014-04-10 15:51:37] [14273] ERROR: The Piwik URL http://www.mySite.com/piwik/index.php does not seem to be pointing to a Piwik server. Response was 'Console ToolUsage: …

PHP Version 5.4.27
System Linux boxxxx.bluehost.com 3.4.72-20131204.1.bh6.x86_64
Server API CGI/FastCGI


(Matthieu Aubry) #2

please upgrade to 2.2.0 : 301 Moved Permanently


#3

Thank you matt for your swift reply.
Tested 2.2.0-rc2 but unfortunately same situation persist.
(Also tested cron task through console and/or archive.php)
Regards


(Matthieu Aubry) #4

Can you post the full output?


#5

Full output.
Calling archive with auth_token from browser:

INFO [2014-04-16 09:19:01] [10083] ---------------------------

INFO [2014-04-16 09:19:01] [10083] INIT

INFO [2014-04-16 09:19:01] [10083] Piwik is installed at: http://mySite.com/piwik/index.php

INFO [2014-04-16 09:19:01] [10083] Running Piwik 2.2.0-rc2 as Super User: juxxxxSU

INFO Piwik\CronArchiveFatalException[2014-04-16 09:19:09] [10083] ERROR: The Piwik URL http://mySite.com/piwik/index.php does not seem to be pointing to a Piwik server. Response was ‘Console ToolUsage: [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. --piwik-domain Piwik URL (protocol and domain) eg. "http://piwik.example.org"Available commands: help Displays help for a command list Lists commandsclimulti climulti:request Parses and executes the given query. See Piwik\CliMulti. Intended only for system usage.core core:archive Runs the CLI archiver. It is an important tool for general maintenance and to keep Piwik very fast. core:plugin Perform various actions regarding one or more plugins. core:update Triggers upgrades. Use it after Piwik core or any plugin files have been updated.customvariables customvariables:info Get info about configured custom variables customvariables:set-max-custom-variables Change the number of available custom variablesdevelopment development:sync-ui-test-screenshots For Piwik core devs. Copies screenshots from travis artifacts to tests/PHPUnit/UI/expected-ui-screenshots/ development:test-files Manage test files.generate generate:api Adds an API to an existing plugin generate:command Adds a command to an existing plugin generate:controller Adds a Controller to an existing plugin generate:plugin Generates a new plugin/theme including all needed files generate:settings Adds a plugin setting class to an existing plugin generate:test Adds a test to an existing plugin generate:theme Generates a new plugin/theme including all needed files generate:visualizationplugin Generates a new visualization plugin including all needed filesgit git:commit Commit git:pull Pull Piwik repo and all submodules git:push Push Piwik repo and all submoduleslog log:watch Outputs the last parts of the log files and follows as the log file grows. Does not work on Windowstests tests:coverage Run all phpunit tests and generate a combined code coverage tests:run Run Piwik PHPUnit tests one group after the other tests:run-ui Run screenshot tests tests:setup-fixture Create a database and fill it with data using a Piwik test fixture.translations translations:createpull Updates translation files translations:fetch Fetches translations files from oTrance to tmp/oTrance translations:languagecodes Shows available language codes translations:languagenames Shows available language names translations:plugins Shows all plugins that have own translation files translations:set Sets new translations for a given language translations:update Updates translation files’.


Error log either calling from browser or from cron task:

[16-Apr-2014 03:19:02] PHP Notice: Undefined index: argv in /pathToPiwik/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 57
[16-Apr-2014 03:19:02] PHP Warning: array_shift() expects parameter 1 to be array, null given in /pathToPiwik/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 61
[16-Apr-2014 03:19:02] PHP Warning: Invalid argument supplied for foreach() in /pathToPiwik/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 287
[16-Apr-2014 03:19:02] PHP Warning: array_shift() expects parameter 1 to be array, null given in /pathToPiwik/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 314
[16-Apr-2014 03:19:02] PHP Warning: Invalid argument supplied for foreach() in /pathToPiwik/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 287
[16-Apr-2014 03:19:02] PHP Warning: array_shift() expects parameter 1 to be array, null given in /pathToPiwik/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 314
[16-Apr-2014 03:19:02] PHP Warning: Invalid argument supplied for foreach() in /pathToPiwik/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 287
[16-Apr-2014 03:19:02] PHP Warning: array_shift() expects parameter 1 to be array, null given in /pathToPiwik/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 314
[16-Apr-2014 03:19:02] PHP Warning: Invalid argument supplied for foreach() in /pathToPiwik/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 287


(Matthieu Aubry) #6

Thanks for the report, I created a ticket at Error when running cron:archive: Response was 'Console ToolUsage: [options] command.... · Issue #5007 · matomo-org/matomo · GitHub

unfortunately I cannot reproduce. Could you please email me access to the server via SSH so I can reproduce and try fix the bug? also pls send the link to ticket 5007

Thanks!


#7

@effie

Can you check whether “register_argc_argv” is enabled in php.ini?
For instance by running:

php -i | grep “register_argc_argv”


#8

@thomas-piwik You’re a lifesaver.
After three months of unsuccessfully trying to execute the previously working crone script (previous to ver 2.1), my beloved application is operational again.
Although executing task through console (core:archive) is still giving me the same errors, I managed running archive with wget and token_auth.
Not the recommended method but a workaround.
Wouldn’t be a good idea to check register_argc_argv parameter in system check of administration panel?
Thank you,
Regards


(Matthieu Aubry) #9

Although executing task through console (core:archive) is still giving me the same errors, I managed running archive with wget and token_auth.

Do you think you could send us access to your piwik console via SSH so we can try to debug the issue?

@Thomas in php.ini I see "Note: This directive is hardcoded to On for the CLI SAPI"
So I think it’s always on for the CLI, so we don’t need to check it. AFAIK it is not required to have it On for the misc/cron/archive.php webcron.


#10

I realize that it would be easier with SSH, but…
Now, what I’ve tried that might be of some help to you:
Let me remind you that server is hosted on a bluehost shared.
Also, the cron task using archive.php started working as soon as I toggled register_argc_argv from Off to On in php.ini.
I’ve run a cron task with phpinfo() and revealed that the default env is 5.2.17, so I formatted the task line as follows:
/usr/php/54/usr/bin/php -c /home/…/public_html/php.ini /home/…/public_html/…/piwik/console core:archive --url=http://…/piwik > /home/…/public_html/…/piwikCron.log
php.ini used above is the same as the one with wget and token_auth.
Results returned from phpinfo() look ok at least regarding register_argc_argv, memory (768M) and php ver 5.4.28 but errors persist.
Although I’m presently satisfied by running the task with wget, I’ll be glad to assist you pinpointing this issue you if you give me instructions.
Regards


#11

I realize that it would be easier with SSH, but…
Now, what I’ve tried that might be of some help to you:
Let me remind you that server is hosted on a bluehost shared.
Also, the cron task using archive.php started working as soon as I toggled register_argc_argv from Off to On in php.ini.
I’ve run a cron task with phpinfo() and revealed that the default env is 5.2.17, so I formatted the task line as follows:
/usr/php/54/usr/bin/php -c /home/…/public_html/php.ini /home/…/public_html/…/piwik/console core:archive --url=http://…/piwik > /home/…/public_html/…/piwikCron.log
php.ini used above is the same as the one with wget and token_auth.
Results returned from phpinfo() look ok at least regarding register_argc_argv, memory (768M) and php ver 5.4.28.
Although I’m presently satisfied by running the task with wget, I’ll be glad to assist you pinpointing this issue you if you give me instructions.
Regards


#12

I realize that it would be easier with SSH, but…
Now, what I’ve tried that might be of some help to you:
Let me remind you that server is hosted on a bluehost shared.
Also, the cron task using archive.php started working as soon as I toggled register_argc_argv from Off to On in php.ini.
I’ve run a cron task with phpinfo() and revealed that the default env is 5.2.17, so I formatted the task line as follows:
/usr/php/54/usr/bin/php -c /home/…/public_html/php.ini /home/…/public_html/…/piwik/console core:archive --url=http://…/piwik > /home/…/public_html/…/piwikCron.log
php.ini used above is the same as the one with wget and token_auth.
Results returned from phpinfo() look ok at least regarding register_argc_argv, memory (768M) and php ver 5.4.28.
Although I’m presently satisfied by running the task with wget, I’ll be glad to assist you pinpointing this issue you if you give me instructions.
Regards


#13

I am running into the same problem. I am using same hosting company as @effie, Bluehost.com

Found defect 5007.

Test run 1 - using oiginal value register_argc_argv = Off, result was the “help” page from the console tool (attached as before.pdf)
Test run 2 - changed to register_argc_argv = On, result was similar (attached as after.pdf).

On the second run the output includes the INFO lines and the date/timestamp which are missing on the 1st run.

Trying to specify the --piwik-domain does not work - any options inserted in front of core:archive seem to confuse PHP and are not honored.

Thanks for your help

Piwik 2.3.0-rc4
Apache 2.2.27
PHP Version 5.4.28
MySQL version 5.5.37-log
Architecture x86_64
Operating system linux


#14

We had a similar ticket recently see. @effie can you maybe check this comment: Undefined index: argv in ...../vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 57 · Issue #5224 · matomo-org/matomo · GitHub


#15

I thought I had already posted this here but apparently not: @effie would you mind having a look at this ticket in case PHP is running as CGI… : Undefined index: argv in ...../vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 57 · Issue #5224 · matomo-org/matomo · GitHub

Might also explain why “register_argc_argv” helped for you


(Matthieu Aubry) #16

@eh215pi please check out Thomas reply as maybe it would help?


#17

OK- checked the response above and the response to my ticket # 5224.

Found out that the path for PHP-CLI, so I switched to that and now it starts but fails with the message below:

INFO CoreConsole[2014-05-31 14:25:03] [77371] ---------------------------
INFO CoreConsole[2014-05-31 14:25:03] [77371] INIT
INFO CoreConsole[2014-05-31 14:25:03] [77371] Piwik is installed at: http://behunt.net/pi1226/index.php
INFO CoreConsole[2014-05-31 14:25:03] [77371] Running Piwik 2.3.0-rc4 as Super User
INFO CoreConsole[2014-05-31 14:25:05] [77371] ---------------------------
INFO CoreConsole[2014-05-31 14:25:05] [77371] NOTES
INFO CoreConsole[2014-05-31 14:25:05] [77371] - If you execute this script at least once per hour (or more often) in a crontab, you may disable ‘Browser trigger archiving’ in Piwik UI > Settings > General Settings.
INFO CoreConsole[2014-05-31 14:25:05] [77371] See the doc at: How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo
INFO CoreConsole[2014-05-31 14:25:05] [77371] - Reports for today will be processed at most every 10 seconds. You can change this value in Piwik UI > Settings > General Settings.
INFO CoreConsole[2014-05-31 14:25:05] [77371] - Reports for the current week/month/year will be refreshed at most every 3600 seconds.
INFO CoreConsole[2014-05-31 14:25:05] [77371] - Will process 1 websites with new visits since 7 days 0 hours , IDs: 1
INFO CoreConsole[2014-05-31 14:25:05] [77371] - Will process 1 other websites because the last time they were archived was on a different day (in the website’s timezone) , IDs: 2
INFO CoreConsole[2014-05-31 14:25:06] [77371] ---------------------------
INFO CoreConsole[2014-05-31 14:25:06] [77371] START
INFO CoreConsole[2014-05-31 14:25:06] [77371] Starting Piwik reports archiving…
INFO CoreConsole[2014-05-31 14:25:08] [77371] WARNING: Empty or invalid response 'VERBOSE VisitsSummary[2014-05-31 14:25:07] [0d770] day archive, idSite = 1 (temporary archive), segment ‘’, report = ‘VisitsSummary’, UTC datetime [2014-05-31 06:00:00 -> 2014-06-01 05:59:59]
VERBOSE VisitsSummary[2014-05-31 14:25:07] [0d770] day archive, idSite = 1 (temporary archive), segment ‘visitorType==returning,visitorType==returningCustomer’, report = ‘VisitsSummary’, UTC datetime [2014-05-31 06:00:00 -> 2014-06-01 05:59:59]
a:52:{s:10:“2014-04-10”;a:26:
{s:16:“nb_uniq_visitors”;d:3;s:9:“nb_visits”;d:3;s:10:“nb_actions”;d:3;s:11:“max_actions”;d:1;s:11:“bounce_rate”;s:4:“100%”;s:20:“nb_actions_per_visit”;d:1;s:16

and it continues a long ways, ending with

INFO CoreConsole[2014-05-31 14:25:11] [77371] Done archiving!
INFO CoreConsole[2014-05-31 14:25:11] [77371] ---------------------------
INFO CoreConsole[2014-05-31 14:25:11] [77371] SUMMARY
INFO CoreConsole[2014-05-31 14:25:11] [77371] Total visits for today across archived websites: 0
INFO CoreConsole[2014-05-31 14:25:11] [77371] Archived today’s reports for 0 websites
INFO CoreConsole[2014-05-31 14:25:11] [77371] Archived week/month/year for 0 websites
INFO CoreConsole[2014-05-31 14:25:11] [77371] Skipped 2 websites: no new visit since the last script execution
INFO CoreConsole[2014-05-31 14:25:11] [77371] Skipped 0 websites day archiving: existing daily reports are less than 10 seconds old
INFO CoreConsole[2014-05-31 14:25:11] [77371] Skipped 0 websites week/month/year archiving: existing periods reports are less than 3600 seconds old
INFO CoreConsole[2014-05-31 14:25:11] [77371] Total API requests: 0
INFO CoreConsole[2014-05-31 14:25:11] [77371] done: 0/2 0%, 0 vtoday, 0 wtoday, 0 wperiods, 0 req, 5039 ms, no error
INFO CoreConsole[2014-05-31 14:25:11] [77371] Time elapsed: 5.039s
INFO CoreConsole[2014-05-31 14:25:11] [77371] ---------------------------
INFO CoreConsole[2014-05-31 14:25:11] [77371] SCHEDULED TASKS
INFO CoreConsole[2014-05-31 14:25:11] [77371] Starting Scheduled tasks…
INFO CoreConsole[2014-05-31 14:25:11] [77371] No task to run
INFO CoreConsole[2014-05-31 14:25:11] [77371] done
INFO CoreConsole[2014-05-31 14:25:11] [77371] -------------------------

my command line is:

/ramdisk/php/54/bin/php54-cli -c /home1/behuntne/software/scripts/php.ini -f /home1/behuntne/public_html/pi1226/console core:archive --url=http://behunt.net/pi1226/ > /home1/behuntne/tmp/archivelog.txt

Doesn’t matter what value I specifiy for register_argc_argv


#18

@thomas-piwik, @matt, you’re both great. Forcing cron to run in cli (and not the default cgi mode) did the trick. Now running cron through console:archive works like a charm. For those that might face the same problem, folowing task works on a bluehost shared hosting.
Of course you’ll have to adjust your specifics (user, ini location, site name etc).
/usr/php/54/usr/bin/php-cli -c /home/…/public_html/php.ini /home/…/public_html/…/piwik/console core:archive --url=http://…/piwik > /home/…/public_html/…/piwikCron.log
For me, issue RESOLVED,
thank you once more.


#19

Never Mind - I had LogLevel = Verbose turned on in the configurations

EH