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

Configurable php executable for archive.sh #1989

Closed
anonymous-matomo-user opened this issue Jan 9, 2011 · 9 comments
Closed

Configurable php executable for archive.sh #1989

anonymous-matomo-user opened this issue Jan 9, 2011 · 9 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. worksforme The issue cannot be reproduced and things work as intended.

Comments

@anonymous-matomo-user
Copy link

It would be nice to have the possibility to configure the path and name of the php executable to bypass the search mechanism.

@mattab
Copy link
Member

mattab commented Jan 9, 2011

What is your php path? why is not picked up by archive.sh?

@anonymous-matomo-user
Copy link
Author

On my hosters server there are at least two versions of php installed. At some point (I don't know why) it started to give a segmentation fault with the older version. I had to change the script to have the version 5.3 started. But with the next update of piwik I will have to change the script again, until the hoster solved the problem with the segmentation fault.

So the php path is picked up by archive.sh but I would like to bypass the mechanism to set the path myself without changing archive.sh.

@mattab
Copy link
Member

mattab commented Jan 9, 2011

OK makes sense, if you can provide a patch it's more likely we will do the change :)

@anonymous-matomo-user
Copy link
Author

I can try...

should it use a parameter for the script or a configuration file to provide the optional path? what would make sense in the piwik architecture?

@robocoder
Copy link
Contributor

This has come up before, and I don't think it requires a change to the script, since it's environment specific.

The FAQ has:

MAILTO="youremail@example.com"
5 * * * * www-data /path/to/piwik/misc/cron/archive.sh > /dev/null

Can you add a PATH= line to your crontab, so it looks like:

PATH=/path_to_working_php_dir/:$PATH
MAILTO="youremail@example.com"
5 * * * * www-data /path/to/piwik/misc/cron/archive.sh > /dev/null

@anonymous-matomo-user
Copy link
Author

As the hosting provider allows only to create cron jobs through a web gui I can't add the PATH= line to the crontab.

But with your input I found another solution. I created a wrapper around archive.sh and called it archive-ex.sh. The cron job calls now my new script. Inside this script I set the path and call then the archive.sh script:

#!/bin/sh -e

# Description
# This script is a wrapper for the archive.sh script to configure the path to the php
# executable. The script adapts the path and calls then archive.sh

PATH='/path/to/php':$PATH

/path/to/piwik/misc/cron/archive.sh

With this solution I don't need this feature anymore. The ticket can be closed in my oppinion.

Thanks for your support!

@robocoder
Copy link
Contributor

Ok.

p.s. some environments may allow something like this one-liner:

5 * * * * PATH=/path/to/php:$PATH /path/to/piwik/misc/cron/archive.sh > /dev/null

Similarly, if your host didn't have /bin/sh:

5 * * * * PATH=/path/to/php:$PATH /path/to/shell /path/to/piwik/misc/cron/archive.sh > /dev/null

@robocoder
Copy link
Contributor

(Matt: why does the FAQ example have "www-data" in it?)

@anonymous-matomo-user
Copy link
Author

Replying to vipsoft:

(Matt: why does the FAQ example have "www-data" in it?)

there are two different types of cronab files:

the system crontab, in /etc/crontab (and includes in /etc/cron.d/). that has a username field to specify the user to run the job as, and user crontabs, which don't haev it (because jobs always run as the owner of the crontab).

www-data is the name of the user the webserver runs as on most distributions... and it's best to run the cronjob as the same user.

the example without username is for putting directly into that user's crontab (which is also what your web interface most likely uses)

@anonymous-matomo-user anonymous-matomo-user added this to the Future releases milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

3 participants