Forum Moderators: bakedjake

Message Too Old, No Replies

small cron problem

does not find the script....

         

Algebrator

5:29 pm on Nov 25, 2004 (gmt 0)

10+ Year Member



I am trying to start my first cron job and having a little problem.
Cron deamon sends me this message:

/usr/home/webXXX/www/htdocs/test2.php
: not found

(where webXXX is my root)

I tried using
/usr/home/webXXX/www/htdocs/test2.php as well as
~/www/htdocs/test2.php
in the crontab file, with the same result.
test2.php is definitely in my htdocs.
Any ideas?
Thanks

jatar_k

10:02 pm on Nov 25, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



are you sure that
/usr/home/webXXX/www/htdocs/test2.php

is the true path from the server root? If the cron can't find it then it is something in the path I would guess.

I usually run my crons in a browser while testing and then move them above the root to their true home (in my system) once I know they work properly. I can then echo testing data (such as paths ;) ) to the browser for ease of debugging.

Algebrator

11:22 pm on Nov 25, 2004 (gmt 0)

10+ Year Member



Paths seem to be OK - I am using them in the php script, which works fine from the browser.
There seems to be more to it then just invalid path. Basically, I am new to both PHP, Linux and server side programming and I am trying to learn 'on-the-fly'.
I can't run the php file from the command prompt either - apparently it needs browser for interpretation and I need to compile it... I need to do more research before asking another question
Thanks

MattyMoose

12:04 am on Nov 26, 2004 (gmt 0)

10+ Year Member



What we normally do for PHP scripts that are supposed to run from the command line is one of these two (usually option 2):

1) edit the php script and add "#!/usr/local/bin/php" (no quotes) to the FIRST line of the file. That will tell your shell what interpreter to open, so basically bash runs "/usr/local/bin/php /the/script/youre/running.php"

2) in your cron, actually specify where your PHP binary is. Usually in /usr/local/bin. If it's not there, and you're not sure where it is, type: "whereis php" or "locate php". Then, in your crontab, add a line like:
"0 0 * * * /usr/local/bin/php /path/to/your/php/file.php"

This tells the PHP CLI to parse your script.

PS: If you still don't see the php binary, it may be that you need to install the CLI packages.

HTH
MM

kdehead

11:33 am on Dec 8, 2004 (gmt 0)

10+ Year Member



"I can't run the php file from the command prompt either - apparently it needs browser for interpretation and I need to compile it... I need to do more research before asking another question "

that's your problem - you dont have the php-cli installed.
what distro are you using?

In Debian you can install it by doing

apt-get php-cli

to test it , drop to a console and type (as root)
php -v

You should then get something like this:
# php -v
PHP 4.3.8 (cli) (built: Jul 30 2004 13:00:16)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with DBG v2.11.23, (C) 2000,2001,2002,2003, by Dmitri Dmitrienko

papayiya

7:10 am on Dec 12, 2004 (gmt 0)

10+ Year Member



if you are still having problem use something like [webbasedcron.com...]

good luck,
George