Results 1 to 5 of 5
Greetings,
I'm playing with creating cronjobs, which are new to me. I have a php script that writes to a log file with some simple output. My php script works; ...
- 11-12-2008 #1Just Joined!
- Join Date
- Apr 2008
- Posts
- 8
[SOLVED] Call a php script from a cronjob
Greetings,
I'm playing with creating cronjobs, which are new to me. I have a php script that writes to a log file with some simple output. My php script works; I've tested that. I know the basics of adding a cronjob, but I can't get my php script to run from my cronjob. My php script is named: mylog.php.
currently my cronjob looks like this:
30 15 * * * /home/jdc/myfiles/mylog.php
I'm thinking that I need to use the php command to run the php script. Can anyone let me know how to do this or tell me what I'm doing wrong?
Thanks,
JohnC
- 11-12-2008 #2Just Joined!
- Join Date
- Apr 2008
- Posts
- 8
Do cronjobs only run on a webserver? I'm not running a webserver, I'm only doing this on my laptop. A friend mentioned that she thought crons could only work when running on a server setup.
Thanks
- 11-13-2008 #3
You will need to have the php cli version installed and then call it with
Code:php /home/jdc/myfiles/mylog.php
If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.
- 11-14-2008 #4Just Joined!
- Join Date
- Apr 2008
- Posts
- 8
Thank you,
I actually figured this out just before I read your post. I'm not sure what you mean by the php "cli" (client?). But, it was the path to the mycron.php file. I needed the full path, as you posted.
That lets my file run.
Thanks again for the help.
How do I mark these threads complete or resolved?
- 11-14-2008 #5Just Joined!
- Join Date
- Apr 2008
- Posts
- 8
sorry, I miss posted my file name. It is /home/jdc/myfiles/mylog.php. It works.


