Current time: 04-24-2014, 09:21 AM Hello There, Guest! (LoginRegister)

Post Reply 
PHP Cron Job Problems
09-01-2006, 02:27 AM
Post: #1
PHP Cron Job Problems
Hi all,

I am trying to set up a cron job to run every night. At the moment the line looks like this:

* 0 * * * /dh/cgi-system/php.cgi /home/username/domain.com/scripts/script.php

When this executes I get an email saying:

"No input file specified."

I have tried running the command on its own from the command line and it works fine. I have also tried this using /usr/local/bin/php instead but get the same outcome (works fine from command line but says "No input file specified" when run from cron).

Any ideas?
Find all posts by this user
Quote this message in a reply
09-01-2006, 02:34 AM
Post: #2
PHP Cron Job Problems
What happens if you run it from the web?

--rlparker
Find all posts by this user
Quote this message in a reply
09-01-2006, 02:39 AM
Post: #3
PHP Cron Job Problems
Is /dh/cgi-system/php.cgi the full path? Cron will like the full path.
When you enter the crontab (crontab -e) make sure you add a newline at the end by pressing enter.
Also script.php should be executable which is what you probably have already.
You might also try a double 0 as a last ditch, over the top boys, attempt.

--
Norm


Opinions are my own views, not DreamHosts'.
I am NOT a DreamHost employee OK!! Angry

You act on my advice at your own risk!
Visit this user's website Find all posts by this user
Quote this message in a reply
09-01-2006, 02:51 AM
Post: #4
PHP Cron Job Problems
The script runs fine when run from the web. That is actually how I am having to run it at present.

I tihkn /dh/cgi-system/php.cgi is the full path. I got it from the Dreamhost wiki. I have also tried it using /usr/local/bin/php but no joy.

Script.php is 755 so shouldn't be a problem there. Have also tried a variety of times but not working. It is a couple of PHP scripts that I have not working also. Both have the same problems.

Fell foul of the newline problem at first but even with that it is still presenting problems.
Find all posts by this user
Quote this message in a reply
09-01-2006, 03:12 AM
Post: #5
PHP Cron Job Problems
What is the wiki page you are looking at? Some of the wiki entries have been there a while and may not have had paths updated as DreamHost changed and evolved.

--
Norm


Opinions are my own views, not DreamHosts'.
I am NOT a DreamHost employee OK!! Angry

You act on my advice at your own risk!
Visit this user's website Find all posts by this user
Quote this message in a reply
09-01-2006, 03:23 AM
Post: #6
PHP Cron Job Problems
The page is:
http://wiki.dreamhost.com/index.php/Cron
Find all posts by this user
Quote this message in a reply
09-01-2006, 03:34 AM
Post: #7
PHP Cron Job Problems
I tend to use /usr/local/bin/php and then make sure #!/usr/local/bin/php -q is the first line of the script.

So a full line would be:-

1,11,21,31,41,51 * * * * /usr/local/bin/php /home/username/domain/somefolder/reminders.php >/dev/null 2>&1

Noting the space after PHP (The dev/null just dumps any screen messages)

If you still get errors then it may be something wrong in your script.php which you may want to show here if you wish so others can check it over.

--
Norm


Opinions are my own views, not DreamHosts'.
I am NOT a DreamHost employee OK!! Angry

You act on my advice at your own risk!
Visit this user's website Find all posts by this user
Quote this message in a reply
09-01-2006, 05:31 AM
Post: #8
PHP Cron Job Problems
Thanks Norm,

I have tried using /usr/local/bin/php but it still gives me a "No input file found" message.

The script runs fine when run from the browser or from the command line so I don't think it is an issue with the script.
Find all posts by this user
Quote this message in a reply
09-01-2006, 05:46 AM
Post: #9
PHP Cron Job Problems
It might be worth contacting support in that case with a link to this thread so they know what you have tried.

Have you tried setting up a simple crontab just to make sure that, that part of your account is okay?

--
Norm


Opinions are my own views, not DreamHosts'.
I am NOT a DreamHost employee OK!! Angry

You act on my advice at your own risk!
Visit this user's website Find all posts by this user
Quote this message in a reply
09-01-2006, 05:51 AM
Post: #10
PHP Cron Job Problems
No I haven't. I will give that one a try.

Thanks for all the help btw. Very much appreciated.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: