Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-11-2003, 04:20 AM   #1
LQ Newbie
Registered: Jun 2003
Distribution: Redhat 7.3
Posts: 14

Rep: Reputation: 0
Cron Job Problem

Hi I have a question about cron job

is there a way to execute a php script every lest say half an hour ?
I understand that something like:
30 * * * * path/script_name.php will do no good cause i need apache server to execute it... does any one know the command needed for that ?

Old 08-11-2003, 04:46 AM   #2
Registered: Sep 2002
Location: .at
Distribution: SuSE, Knoppix
Posts: 532

Rep: Reputation: 31
your script should start with a line like:

[.....PHP SCRIPT HERE ....]

and the x-bit should be set and the script should be readable to cron (e.g. chmod ugo+rx /path/to/script)
Old 08-11-2003, 04:47 AM   #3
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188

Rep: Reputation: 30
this should work, as PHP by itself doesn't need apache.

from the command line, try:

php yourscript.php

and see if it works. you can then do a cron job for it.
Old 08-11-2003, 07:29 AM   #4
Registered: Aug 2003
Location: Austria
Distribution: Fedora Core release 2 (Tettnang)
Posts: 37

Rep: Reputation: 15
Well, for PHP to work on the shell without apache, you need to compile it as an cgi. (meaning without --with-apxs)

But you also could do something like
lynx localhost/script.php

that should work as well... I am not 100% if it would work like I wrote it, but I do not that it does, cos I did it like a year ago, once....long time ago...

best regards
Old 08-12-2003, 04:27 AM   #5
LQ Newbie
Registered: Jun 2003
Distribution: Redhat 7.3
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for the help

Followed jalal advice and it worked perfectly, all that is needed is to add php before the script name.

Thanks again.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
scp problem in cron job andreolira Linux - General 9 09-08-2008 05:27 PM
cron job problem graziano1968 Linux - Software 7 08-27-2005 01:41 AM
cron job wbatzle Linux - Newbie 2 07-12-2005 05:19 PM
Problem displaying program output when driven by a cron job garmon Linux - Newbie 1 07-22-2004 03:34 PM
problem in cron job setting gauravdream Linux - General 1 02-23-2004 01:08 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration