Submitted by PatTzZ on Fri, 12/05/2014 - 17:00 Pro Licensee
Hi!
We need to have php to setup cronjob for us. I've read that it's possible to do it.
Can you point us to requirment and how to achieve it from a virtual server account?
Thanks in advance for your help!
Status:
Active
Comments
Submitted by JamieCameron on Fri, 12/05/2014 - 17:32 Comment #1
Do you mean create a cron job from a PHP script? This may be possible, if the cron job runs as the domain's user ... however, there is no real API for this. Instead your script would need to somehow call the
crontab
command.Submitted by PatTzZ on Fri, 12/05/2014 - 18:52 Pro Licensee Comment #2
Yes i mean by a php script.
My programmer asked me about it. He's thinking that some server restriction make it to dont work simply. He tried in few ways but didt get it to work.
If you have some clues about how to achieve it, it will be appreciate. If not, i will ask him to digg more deeper about it.
Thanks!
Submitted by andreychek on Fri, 12/05/2014 - 19:11 Comment #3
A Virtual Server owner is welcome to add a cron job, there aren't any restrictions that would prevent that from working.
There are a few thoughts on adding cron jobs via the command line in the posting here:
http://stackoverflow.com/questions/878600/how-to-create-cronjob-using-bash
Submitted by PatTzZ on Sat, 12/06/2014 - 06:52 Pro Licensee Comment #4
From the command line it's working. It isnt from php, that's the reason why.
Submitted by andreychek on Sat, 12/06/2014 - 11:14 Comment #5
You may want to verify that in Server Configuration -> Website Options, that your domain is configured to use either FCGID or CGI.
If it's using mod_php, that may indeed be a problem, as mod_php runs as the Apache user, not as the Virtual Server owner. The Apache user doesn't have rights to create cron entries for your Virtual Server owner.
Submitted by PatTzZ on Sat, 12/06/2014 - 11:43 Pro Licensee Comment #6
It's running FCGId
Submitted by andreychek on Sat, 12/06/2014 - 11:49 Comment #7
Yeah that should be possible then. It sounds like you're likely to be seeing an issue with the particular PHP script. So long as the PHP app is running as the Virtual Server, it should be able to work, there's nothing preventing it from adding, modifying, and deleting cron jobs for that user.
Submitted by PatTzZ on Sat, 12/06/2014 - 12:03 Pro Licensee Comment #8
Ok, i will advise my programmer about it.
Thanks again for your support!