Auto Geoip Db update may fail, Tar library not loading in some server configs #4533

Closed
jloh opened this Issue Jan 15, 2014 · 8 comments

4 participants

@jloh

If you don't have php-pear installed on the system and use the GeoIP auto-updater it fails to download/unpack the new files with a error like this:

Error: Got invalid response from API request: https://stats.example.comstats.example.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=00000000000000000000&trigger=archivephp. Response was '<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'>
        <strong>There is an error. Please report the message (Piwik 2.0.3)
        and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/>
        Warning:</strong> <em>require_once(PEAR.php): failed to open stream: No such file or directory</em> in <strong>/var/www/stats.example.com/docroot/libs/Archive_Tar/Tar.php</strong> on line <strong>42</strong>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt"><br />
#0  Piwik\Error::errorHandler(...) called at [/var/www/stats.example.com/docroot/libs/Archive_Tar/Tar.php:42]<br />
#1  require_once(...) called at [/var/www/stats.example.com/docroot/libs/Archive_Tar/Tar.php:42]<br />
#2  require_once(...) called at [/var/www/stats.example.com/docroot/core/Unzip/Tar.php:18]<br />
#3  require_once(...) called at [/var/www/stats.example.com/docroot/core/Loader.php:101]<br />
#4  Piwik\Loader::tryToLoadClass(...) called at [/var/www/stats.example.com/docroot/core/Loader.php:89]<br />
#5  Piwik\Loader::loadClass(...) called at [/var/www/stats.example.com/docroot/core/Loader.php:117]<br />
#6  Piwik\Loader::autoload(...) called at [:]<br />
#7  spl_autoload_call(...) called at [/var/www/stats.example.com/docroot/core/Unzip.php:41]<br />
#8  Piwik\Unzip::factory(...) called at [/var/www/stats.example.com/docroot/plugins/UserCountry/GeoIPAutoUpdater.php:186]<br />
#9  Piwik\Plugins\UserCountry\GeoIPAutoUpdater::unzipDownloadedFile(...) called at [/var/www/stats.example.com/docroot/plugins/UserCountry/GeoIPAutoUpdater.php:158]<br />
#10  Piwik\Plugins\UserCountry\GeoIPAutoUpdater->downloadFile(...) called at [/var/www/stats.example.com/docroot/plugins/UserCountry/GeoIPAutoUpdater.php:102]<br />
#11  Piwik\Plugins\UserCountry\GeoIPAutoUpdater->update(...) called at [:]<br />
#12  call_user_func(...) called at [/var/www/stats.example.com/docroot/core/TaskScheduler.php:196]<br />
#13  Piwik\TaskScheduler::executeTask(...) called at [/var/www/stats.example.com/docroot/core/TaskScheduler.php:133]<br />
#14  Piwik\TaskScheduler->doRunTasks(...) called at [/var/www/stats.example.com/docroot/core/TaskScheduler.php:83]<br />
#15  Piwik\TaskScheduler::runTasks(...) called at [/var/www/stats.example.com/docroot/plugins/CoreAdminHome/API.php:41]<br />
#16  Piwik\Plugins\CoreAdminHome\API->runScheduledTasks(...) called at [:]<br />
#17  call_user_func_array(...) called at [/var/www/stats.example.com/docroot/core/API/Proxy.php:213]<br />
#18  Piwik\API\Proxy->call(...) called at [/var/www/stats.example.com/docroot/core/API/Request.php:220]<br />
#19  Piwik\API\Request->process(...) called at [/var/www/stats.example.com/docroot/plugins/API/Controller.php:34]<br />
#20  Piwik\Plugins\API\Controller->index(...) called at [:]<br />
#21  call_user_func_array(...) called at [/var/www/stats.example.com/docroot/core/FrontController.php:117]<br />
#22  Piwik\FrontController->dispatch(...) called at [/var/www/stats.example.com/docroot/index.php:62]<br />
</div><br />
 </pre></div><br />'
1 total errors during this script execution, please investigate and try and fix these errors
ERROR: 1 total errors during this script execution, please investigate and try and fix these errors. First error was: Got invalid response from API request: https://stats.example.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=00000000000000000000&trigger=archivephp. Response was '<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'>
        <strong>There is an error. Please report the message (Piwik 2.0.3)
        and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/>
        Warning:</strong> <em>require_once(PEAR.php): failed to open stream: No such file or directory</em> in <strong>/var/www/stats.example.com/docroot/libs/Archive_Tar/Tar.php</strong> on line <strong>42</strong>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt"><br />
#0  Piwik\Error::errorHandler(...) called at [/var/www/stats.example.com/docroot/libs/Archive_Tar/Tar.php:42]<br />
#1  require_once(...) called at [/var/www/stats.example.com/docroot/libs/Archive_Tar/Tar.php:42]<br />
#2  require_once(...) called at [/var/www/stats.example.com/docroot/core/Unzip/Tar.php:18]<br />
#3  require_once(...) called at [/var/www/stats.example.com/docroot/core/Loader.php:101]<br />
#4  Piwik\Loader::tryToLoadClass(...) called at [/var/www/stats.example.com/docroot/core/Loader.php:89]<br />
#5  Piwik\Loader::loadClass(...) called at [/var/www/stats.example.com/docroot/core/Loader.php:117]<br />
#6  Piwik\Loader::autoload(...) called at [:]<br />
#7  spl_autoload_call(...) called at [/var/www/stats.example.com/docroot/core/Unzip.php:41]<br />
#8  Piwik\Unzip::factory(...) called at [/var/www/stats.example.com/docroot/plugins/UserCountry/GeoIPAutoUpdater.php:186]<br />
#9  Piwik\Plugins\UserCountry\GeoIPAutoUpdater::unzipDownloadedFile(...) called at [/var/www/stats.example.com/docroot/plugins/UserCountry/GeoIPAutoUpdater.php:158]<br />
#10  Piwik\Plugins\UserCountry\GeoIPAutoUpdater->downloadFile(...) called at [/var/www/stats.example.com/docroot/plugins/UserCountry/GeoIPAutoUpdater.php:102]<br />
#11  Piwik\Plugins\UserCountry\GeoIPAutoUpdater->update(...) called at [:]<br />
#12  call_user_func(...) called at [/var/www/stats.example.com/docroot/core/TaskScheduler.php:196]<br />
#13  Piwik\TaskScheduler::executeTask(...) called at [/var/www/stats.example.com/docroot/core/TaskScheduler.php:133]<br />
#14  Piwik\TaskScheduler->doRunTasks(...) called at [/var/www/stats.example.com/docroot/core/TaskScheduler.php:83]<br />
#15  Piwik\TaskScheduler::runTasks(...) called at [/var/www/stats.example.com/docroot/plugins/CoreAdminHome/API.php:41]<br />
#16  Piwik\Plugins\CoreAdminHome\API->runScheduledTasks(...) called at [:]<br />
#17  call_user_func_array(...) called at [/var/www/stats.example.com/docroot/core/API/Proxy.php:213]<br />
#18  Piwik\API\Proxy->call(...) called at [/var/www/stats.example.com/docroot/core/API/Request.php:220]<br />
#19  Piwik\API\Request->process(...) called at [/var/www/stats.example.com/docroot/plugins/API/Controller.php:34]<br />
#20  Piwik\Plugins\API\Controller->index(...) called at [:]<br />
#21  call_user_func_array(...) called at [/var/www/stats.example.com/docroot/core/FrontController.php:117]<br />
#22  Piwik\FrontController->dispatch(...) called at [/var/www/stats.example.com/docroot/index.php:62]<br />
</div><br />
 </pre></div><br />'

Once php-pear is installed the error goes away and the system works fine.

I've confirmed this bug several times on debain 6/7

@jloh

Please note there is a typo on the first line, my search replace for my actual URL borked, it doesn't in the log read the URL of the website twice, only once.

@mattab
Piwik Open Source Analytics member

I guess you are not using piwik 2.0.3 ? this bug should be fixed. Piwik does not require PEAR

@halfdan
Piwik Open Source Analytics member

@mattab: The error message clearly states that this is Piwik 2.0.3. We should look into this.

@hpvd

maybe you both are right :-)

as far as I have noticed within earlier versions of piwik,
the version number "2.0.3" is shown as soon as you uses one of the earliest betas of piwik.
But there are often really lots of changes until the final arrives...

so the problem may be there in 2.0.3 (early beta) and it was fixed in 2.0.3 too (later beta or final)

=> so we should show detailed beta version information in error messages too (if note already available)

@jloh

Actually, it does seem to require it. Look here: https://github.com/piwik/piwik/blob/master/libs/Archive_Tar/Tar.php

Right at the top of the page, PEAR.php

@mattab
Piwik Open Source Analytics member

Indeed! can you edit "require_once 'PEAR.php'" to "require_once '../PEAR.php'" and check if it fixes it, the next time the task to "update geoip database" runs?

you can see the next time it will run using the TasksTimetable plugin

@jloh

Actually, I think it needs to be

./libs/PEAR.php

due to how the script is called form index.php

I've submitted a pull request #207 Github.com hopefully it's right.

@halfdan
Piwik Open Source Analytics member

It should be

require_once __DIR__ . "/../PEAR.php";
@jloh jloh added this to the 2.1 - Piwik 2.1 milestone Jul 8, 2014
@sabl0r sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
@jloh jloh Fixing PEAR.php path so that the GeoIP untar can function properly wi…
…thout needing php-pear to be installed - bug #4533
4d835a1
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment