Forums | Mahara Community

Support /
Help with the cron job!


anonymous profile picture
Account deleted
Posts: 6

09 March 2009, 5:49

Ok so, Hopefully this will be the last issue...

I am trying to set up my cron job using the crontab in plesk. However, whenever I get the email telling me its been run I just get an error saying that safe_mode is switched on, which I believe its not, because I can run Mahara in a web browser...

 Any ideas? 

anonymous profile picture
Account deleted
Posts: 1643

09 March 2009, 6:47

That could be because there are two different php.inis depending on whether you use the command line php or run php through a web browser, and the command line one could have safe mode on.

I think the solution for you is tor run a cron job that uses curl to hit the cron script, rather than php to run it. e.g., use this instead of php /path/to/lib/cron.php:

curl -s http://yoursite.com/lib/cron.php

anonymous profile picture
Account deleted
Posts: 6

10 March 2009, 4:52

When I try that I get this error

 /bin/sh: curl: command not found

10 March 2009, 5:52

Hi,

you are missing the curl package. Install it.

On debian it's a matter of:

# aptitude install curl 

anonymous profile picture
Account deleted
Posts: 228

10 March 2009, 6:33

I would actually try and use the php-cli, but with the apache php.ini, rather than try and use curl... for cronjobs that do a lot, it adds overhead to go through apache.

If you can locate the php.ini that apache is using (it's /etc/php5/apache(2)/php.ini on debian based systems (this includes ubuntu), you can do 

 

php -c /path/to/apache/php.ini /path/to/mahara/cron.php

Hope that helps

Penny

anonymous profile picture
Account deleted
Posts: 6

10 March 2009, 16:44

That totally worked! Thank you very muchly!
6 results