Link to home
Start Free TrialLog in
Avatar of Lightwalker
Lightwalker

asked on

Can a CRON job run a PHP script

Dear Experts,

I am wanting to take full advantage of CRON on my server as there are a lot of repetitive task I do every day that could easy be set up to do automatically. But I have not used CRON before and I have read that it can run a PHP script.

If I created a PHP script and set the trigger to be "on page load" would this be able to be run by CRON at 24 hour intervals. I am also planning to set up a trigger on the PHP script to send me an email to let me know what has been changed so I can keep track. Are there any restrictions or things I should be aware of in doing this.

Many thanks as always to the experts community. I must say that I have worked in many different areas from film, photography, design and a few others and know I am learn a little about programming and web development and PHP as well as web design and I am just amazed everyday and what a truly lovely group of human being developers and programs are. It really lovely to be a part of it. Thank you.
SOLUTION
Avatar of ludofulop
ludofulop

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dave Baldwin
PHP CRON jobs need to be command line PHP programs so they can run under your user.  I don't know if CRON can run as the web user since you don't have permission to be that user if you're not coming in thru the web server.  Other than that, I think it can do what 'you' can do with your files.
Joomla sets up a cron job to run a php script, example here: http://joomlapanel.com/joomla-article/joomla-tutorial/258-setup-cron-job-for-your-joomla-site.html

This page gives some instructions on how to do it.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial