Archive.php giving zero output+results after 1.7 upgrade


#1

We have to sites for which we used archive.sh. After upgrading to piwik1.7 we changed to archive.php – however this does not seem to work (no update of the graphs in the browser (whereas “Visitors in Real Time” is updated)).

I manually ran:


$ /usr/local/bin/php /srv/www/piwik/htdocs/piwik/misc/cron/archive.php

which however gives absolutely no output.

Calling


$ bash /srv/www/piwik/htdocs/piwik/misc/cron/archive.sh

results in


$ bash /srv/www/piwik/htdocs/piwik/misc/cron/archive.sh  
Starting Piwik reports archiving...

Reports archiving finished.
---------------------------
Starting Scheduled tasks...


Finished Scheduled tasks.


Surpringly even if I simply give archive.php the --help option, the output is zero


$ /usr/local/bin/php /srv/www/piwik/htdocs/piwik/misc/cron/archive.php --help

This is on FreeBSD with this php version:


$ /usr/local/bin/php -v
PHP 5.3.10 with Suhosin-Patch (cli) (built: Feb 15 2012 23:31:05) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

Any ideas? At first I thought that maybe the permissions of piwik/tmp where wrong (because archive.php was first complaining about wrong permission on the new tmp/tcpdf which I had to fix with a chmod), but not giving any output at all now does not seem correct.


(Matthieu Aubry) #2

Indeed it’s a problem. Are you familiar with PHP? If so, you could try to “debug” the archive.php to see what is executed and when it fails. In particular around this function: http://dev.piwik.org/trac/browser/trunk/misc/cron/archive.php#L93


#3

I got the same problem, but this has fixed it for me. I set the correct rights for the new folder tcpdf and everything was fine.


#4

I could narrow down the problem now, and it has nothing to do with file/directory permissions:

in core/FrontController.php http://dev.piwik.org/trac/browser/trunk/core/FrontController.php#L263 which is called from init there is a call to Piwik_Url::redirectToUrl($url);


258	            if(Zend_Registry::get('config')->General->force_ssl == 1
259	                && !Piwik::isHttps())
260	            {
261	                $url = Piwik_Url::getCurrentUrl();
262	                $url = str_replace("http://", "https://", $url);
263	                Piwik_Url::redirectToUrl($url);
264	            }

and then in Piwik_Url::redirectToUrl there is a call to exit: http://dev.piwik.org/trac/browser/trunk/core/Url.php#L325

The url parameter is https://unknown/srv/www/piwik/htdocs/piwik/misc/cron/archive.php in my installation, in case this is important.

That’s it. How can I fix this problem? Can you give me a pointer for a patch?

Unsetting the force_ssl option (force_ssl=0) solves the problem, and can be used as a workaround if one does not care about secure connections.


(Matthieu Aubry) #5

Thanks for the report. See the ticket: archive.sh and archive.php are brokenn with force_ssl · Issue #2961 · matomo-org/matomo · GitHub