Calling a PHP script every hour with Cron. - Possible?

They have: 112 posts

Joined: Apr 1999

Hi guys,
Has anyone tried scheduling a php script being called every hour using Cron? To my knowledge, its quite impossible... unless to create a perl script file and call the php script via http.... Correct me if I'm wrong....
Later.

They have: 112 posts

Joined: Apr 1999

I have found the solution. In case if anyone of you need to know, you need to put the following into your crontab:
lynx -dump http://www.myhost.com/myscript.phtml
Thank you.

They have: 5,633 posts

Joined: Jan 1970

though i never experimented it,
I think that you can use php the same way as perl if you compile it as a cgi version.
you can then call a php program using php programname or make the file executable and link the first line to the php interpreter.

They have: 5,633 posts

Joined: Jan 1970

Sorry I didn't reply to this before but I had never experimented with this... Two days ago, I spent 9 hours trying to make it happen, only to find out that you can't execute .php files from the shell if PHP is an Apache Module.

However, Nemo, you are correct. If PHP is installed as a cgi binary instead of an Apache Module, it will run just like a perl script and thus, can be executed via shell.

I really wish I would have thought about looking here about an hour into my journey, but I didn't and thus, spent 9 hours and I got absolutely no where... I barely even knew this thread existed and just happened to notice it today looking for another. Smiling

----------
Dynamic Internet Solutions : http://www.dids.com
UNIX and Windows NT Hosting

They have: 112 posts

Joined: Apr 1999

Chad,
Which kind of method did you choose?

Joe Thong

They have: 5,633 posts

Joined: Jan 1970

Elara,

Due to the fact that we don't have PHP installed as a cgi binary but rather an Apache Module, I had to use your suggestion.

I feel it is kind of make-shift (buy hey, it works and that is all I care about!) so I won't be using it once we get PHP installed as a cgi binary as well.

I really do wish I would have paid more attention to this thread as I would have spent nine minutes on this instead of nine hours!

----------
Dynamic Internet Solutions : http://www.dids.com
UNIX and Windows NT Hosting

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.