Forum Moderators: coopster

Message Too Old, No Replies

How do I start a Cronjob with Cpanel/WHM?

How do I start a Cronjob with Cpanel/WHM?

         

Bigzed

3:11 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



Hey Guys,
I'm using Cpanel and I'm trying to run a PHP Script but it's not working.
It worked when I put "lynx --dumb" in front of the Path but my Provider told me thats not allowed.

So what should I do?
What Do I have to put in front of the Path/URL of the script?

Thanks,
Bigzed.

dreamcatcher

4:04 pm on Mar 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To run a PHP file, use:

php -q /home/server/path/public_html/file.php

Note that there are spaces AFTER -q and PHP. If you don`t type it exactly it will fail.

Good luck.

Bigzed

7:54 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



Hi,
thanks for your answer, unfortunately it still doesn't work. The Message that I get in the cronjob-result mail:
"No input file specified."

Although I know that the Path is correct...

Here my command:
"php -q /home/morpheus/public_html/getdata.php?cron=yes"

dreamcatcher

8:47 pm on Mar 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Strange, should work ok in CPanel, its what I use on all my crons and I have CPanel too.

You might want to try the CPanel forum, they might be able to advise there. Are you using any apostrophes or quotes in your command? Have you run the file manually to see if it works?

dc

George_hu

9:10 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



Bigzed,

Welcome to Webmasterworld!

Running a php scrip from Cron with Cpanel/WHM is pretty easy but there are some tricky thing may apply>

This is what you like to run>
php -q /home/morpheus/public_html/getdata.php?cron=yes

I. try this (sometime needs to define where is php)
/usr/local/bin/php -q /home/morpheus/public_html/getdata.php?cron=yes

II. look into the file what you wanna run and if there any file path inside, where the script read/write any file change that path
like this (this is just an example and hope this makes sense)

let say your file contains this
$zp = gzopen("sql/export/".$exportLib->dbName.".".$time.".sql.gz", "w9");

but sometimes you need to define the full path like this

$zp = gzopen("/home/someuser/public_html/sql/export/".$exportLib->dbName.".".$time.".sql.gz", "w9");

All above depends on the server setting.

[edited by: coopster at 11:15 pm (utc) on Mar. 10, 2005]
[edit reason] no solicitations [webmasterworld.com] please [/edit]

Bigzed

8:06 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



Hi,
ok first thanks for so many answers.

I figured out whats wrong: The Cronjob works if I don't put the?cron=yes at the end of the Internet Adress.

Bigzed.