Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron fails if mysql is not enabled globally #9074

Closed
rfnx opened this issue Oct 21, 2015 · 7 comments
Closed

Cron fails if mysql is not enabled globally #9074

rfnx opened this issue Oct 21, 2015 · 7 comments
Labels
duplicate For issues that already existed in our issue tracker and were reported previously.

Comments

@rfnx
Copy link

rfnx commented Oct 21, 2015

Hello,

I'm trying to setup cron but I'm facing a strange problem. On my server, pdo_mysql.so is not enabled globally, I enable it in the php engine (with uWSGI) only for websites that need it. Some webapps, like piwik or wordpress, need cron to work well and that's why I have to add in the command line each extension I need.

Here is the command line I want to use :

php -d extension=pdo_mysql.so -d extension=gd.so -d extension=iconv.so -d extension=openssl.so -f /path/to/piwik/console core:archive --url=https://analytics.mydomain.com/

But I get this error :

Empty or invalid response 'Error in Piwik: The mysql driver is not currently installed The mysql driver is not currently installed ' for website id 1, Time elapsed: 0.264s, skipping

It's strange because this method works perfectly with my other webapps. Also, why is there a difference between enabling mysql in php.ini or in the command line ?

@rfnx
Copy link
Author

rfnx commented Oct 21, 2015

Ok I really don't know why but after many tries, suddenly it works now... The only thing I did was (like I said in the first post) : enable pdo_mysql.so globally, run the cron (it works) then disable again pdo_mysql.so globally and put it back in the command line. It shouldn't work, but it is.

Maybe the cron has to be launched once with pdo_mysql.so enabled globally ?

@rfnx rfnx closed this as completed Oct 21, 2015
@mattab mattab added the worksforme The issue cannot be reproduced and things work as intended. label Oct 22, 2015
@rfnx
Copy link
Author

rfnx commented Oct 22, 2015

The problem appeared again after one or two hours. So I did some tests :

-Change adapter to mysqli : same error.
-Update to 2.15 : error fixed for some hours, then same issue.

It's very strange, nothing changes between the cron, except the error.

EDIT : the error is a bit different with 2.15:

ERROR [2015-10-22 16:18:42] Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last3&format=php&trigger=archivephp. Response was 'a:2:{s:6:"result";s:5:"error";s:7:"message";s:43:"The mysql driver is not currently installed";}'
ERROR [2015-10-22 16:18:42] Empty or invalid response '' for website id 1, Time elapsed: 0.264s, skipping

@rfnx rfnx reopened this Oct 22, 2015
@tsteur
Copy link
Member

tsteur commented Oct 26, 2015

Maybe this is rather something for our forum http://forum.piwik.org/ ? It seems to be some kind of server configuration problem

@rfnx
Copy link
Author

rfnx commented Oct 26, 2015

I'm not sure it's a server configuration problem but for the moment I enabled mysql globally. Maybe the cron call php and doesn't use the command line arguments I use ? I tried to look at the source code but I don't have the time now, I'll do it later.

@tsteur
Copy link
Member

tsteur commented Oct 26, 2015

The database connection shouldn't depend on the arguments you use. Can you maybe paste the command that you use to run the cron? Is only the cron experiencing such issues or also the Piwik UI? Do they both run as the same user?

@mattab
Copy link
Member

mattab commented Nov 26, 2015

Maybe the cron call php and doesn't use the command line arguments I use ?

I think issue #9258 forward PHP CLI parameters to CLI subrequests, will fix this as well. marking as duplicate

@mattab mattab closed this as completed Nov 26, 2015
@mattab mattab added duplicate For issues that already existed in our issue tracker and were reported previously. and removed worksforme The issue cannot be reproduced and things work as intended. labels Nov 26, 2015
@rfnx
Copy link
Author

rfnx commented Nov 26, 2015

@mattab Thanks :)

Sorry @tsteur, I forgot to answer you. I had other things to do so as a workaround (but not a fix) I enabled mysql globally. I'm now waiting for the new version to try and see if it is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate For issues that already existed in our issue tracker and were reported previously.
Projects
None yet
Development

No branches or pull requests

3 participants