Cron Job Problems - "No input file specified."

[FONT=“Georgia”]Hi there.

I’m on paid hosting and accessing the cron jobs through a control panel.

I have a php script that I’d like to run daily.

I’ve put this script in the folder http://mysite.com/Cron/ .

When I navigate to this file directly in my web-browser it runs perfectly and sends me an e-mail.

When I try to set up a cron tab to execute it, though I get the following error in the cron output…[/FONT]

Status: 404
X-Powered-By: PHP/4.4.6
Content-type: text/html

No input file specified.

The command I entered into the control panel was…

php http://mysite.com/Cron/SendMail.php

I also tried…

php -q http://mysite.com/Cron/SendMail.php

…and…

php /Cron/SendMail.php

…those times getting the error…

/bin/sh: http://mysite.com/Cron/SendMail.php: No such file or directory

[FONT=“Georgia”]Can anyone suggest why this might not be working for me??

I’m completely new to cron jobs, and just going by what I googled.

Many thanks.

[/FONT]

I think the path to your file needs to be based on the actual directory on the server (not via an http request). You were close with this:

php /Cron/SendMail.php

However, the path should be something along the lines of /home/username/mysite.com/Cron/SendMail.php

This depends on how your host has configured the server.

[FONT=“Georgia”]Ore okay. That makes sense.

Is there anyway I can test for this to determine what’s the absolute path??

I doubt they’d tell me if I asked for it.

[/FONT]

There should be no reason they wouldn’t tell you the path to your home folder. Most likely, your public html folder is stashed within your home folder anyway. I would email their support and ask, and while I waited, I would try using

/home/your_username_with_webhost/yourwebsite.com/Cron/SendMail.php and see if that works

As a side note, if you can connect via (s)ftp, you should be able to find the path you’re uploading too…
It would be easy too if you had shell access

[FONT=“Georgia”]SUCCESS!!

I made an info.php file and ran it to get the document root.

You were right… that’s what the problem was… the path to the file needed to be absolute.

Thanks a lot, WoW_15. :tup:

[/FONT]

glad to help