I'm trying to run a script once a night that calls on some php files to update a billing status. I've been trying to run this from the debian crontab but as the php files are stored /var/www/mydomain.com/web/billing/thephp.php cron fails to execute them are they are not stored in the same place as the where the cron job is executed from. So my question is... in debian lenny, where does cron execute it's files from please? David
You can call that php file, but if you use relative includes etc in your php file, you need to chdir first .. you could add Code: chdir("/var/www/mydomain.com/web/billing/"); at the start of your php file. in your crontab you would put something like: Code: @daily www-data /usr/bin/php /var/www/mydomain.com/web/billing/thephp.php
Thanks mark. I'd taken a slightly different approach and made this script which would call the php script. #!/bin/bash cd*./etc /var/www/mydomain.com/web/billing/./statusupdate when I'm back in front of a terminal I'll try your approach I think thanks
Yeah, you can also create a small bash script to chdir to the correct dir and then call the php script good luck!
Another suggestion is to use full path names for all commands and files so it will run the same regardless of where it's called from. No need to change directories that way. (Better for me as on a complicated script I can forget what directory I'm in and start messing things up.)
I see your point amigos. It was not my php script I was trying to get cron to run. It is part of an open source billing system called citrusdb.