Modify to work with DreamHost

When running the cron job on DreamHost to execute the I’m getting the following error message:

php binary not found. Make sure php5 or php exists in PATH.

What I have understood so far is, that I have to modify the to point to the PHP interpreter (in my case PHP is located in /usr/local/bin/php). Where do I modify the script? Or better could somebody please post a modified


If you edit, your changes will be lost when you update Piwik (and the file is overwritten).

Just add /usr/local/bin to your PATH. “echo $PATH”. Then, at the top of your crontab:


I’ve never used the SSH access to set-up my cron (and I’m not very familiar with it either). In DreamHost you can set up the cron jobs in the Panel. Thats the reason I thought my only way out would be to modify the If this file gets updated with every new release it’s out of the question to modify it.

To allow me a good start with creating the cron job with SSH could you please give me the “whole thing” (meaning the cron job) considering:

The location of the Piwik install: /home/myuser/mysite/statistics/misc/cron/
The PHP being located in: /usr/local/bin/php

Thank you!

Ok, I’ve set up a cron job that looks like this (for testing purposes set to 10 minutes):
*/10 * * * * /home/myuser/mysite/statistics/misc/cron/

The result is again: php binary not found. Make sure php5 or php exists in PATH.

You can also do this;

Comment these lines

#for TEST_PHP_BIN in php; do

if which $TEST_PHP_BIN >/dev/null 2>/dev/null; then





And add this line
#Your PHP path

Dreamhost cron does not execute with a normal environment. This means you cannot use bare commands. You just need to add this line before the cron: /usr/local/php5/bin/php

So in their Control Panel, edit your cron so the entire line looks like this: /usr/local/php5/bin/php /home/USERNAME/PIWIKFOLDER/misc/cron/

For more DH cron information, click here:

That won’t work rhotog because is a bash shell script.

Try setting your path at the top of the crontab, e.g.,



We are hosted by 1and1 and have a problem getting the script to run i have tried modifying the script as above adding the path to the cron etc. nothing seems to work, in the end i gave up i just don’t have enough knowledge to implement archiving. still loving piwik tho …ty.

(1and1 use php4 by default, we use the .htaccess trick for php5)
php5 is located at: /usr/bin/php5

we get the following output from the script

/bin/sh: -
: invalid option

We have spoken to our host about it and their reply is below.

Also, i did notice a forum post where a php script had been used as the archiving script but it had stopped working since 1.4. It would be nice if there was an alternative php script for archiving. There must be a lot of users on shared hosts that can not get this to work.,77295

You’re right, thanks Anthon! I thought the script was running fine because I wasn’t getting an error in the Cron emails, but it turns out the script wasn’t being processed. I spent some time with Dreamhost’s Customer Service and was able to get it running by doing the following steps:

  1. Log in to the account using SSH
  2. Enter this into the command line: “echo $PATH”
  3. This spit out a bunch of path variables. Copy this data.
  4. Go to the Cron Job and enter the PATH data before the cron. It should look something like this:

PATH=/usr/local/bin:/usr/bin:/bin:/usr/games /bin/bash /home/USERNAME/PIWIKFOLDER/misc/cron/

Note that this command was entered using the Cron Job manager in their Control Panel, not the SSH command line.

When the script ran, I was also getting the following error:

suhosin[28236]: ALERT - script tried to increase memory_limit to 134217728 bytes which is above the allowed value (attacker '', file '/home/USERNAME/PIWIKFOLDER/core/Piwik.php', line 881)

I changed the minimum_memory_limit in config.ini to be 85MB and the script ran without errors. I’m on a VPS, so the memory limit might be lower for standard hosting packages. Now my Piwik dashboard is running very fast! :slight_smile:

I hope this helps save someone else the time it took to troubleshoot.

Edit: Updated the cron command for accuracy and included better instructions

Thank you rhotog for the explanations.

It has been very helpful. :slight_smile: