LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cron job running PHP script to update MySQL - access denied error (https://www.linuxquestions.org/questions/linux-newbie-8/cron-job-running-php-script-to-update-mysql-access-denied-error-671924/)

Beauford2008 09-23-2008 09:49 PM

cron job running PHP script to update MySQL - access denied error
 
I have a cronjob set up to run every 5 minutes and all it does is run a PHP script and updates a MySQL database. I am getting this error.

/bin/sh: /usr/bin/curl: Permission denied

The directory permissions are drwxr-xr-x
File permissions are set to -rwxr-xr-x

I have tried these in for the cronjob

*/5 * * * * curl /public_html/directory/cron_fivemins.php
or
*/5 * * * * curl http://www.url.com/cron_fivemins.php

If I run the script manually it works fine, so I am assuming it is a permissions issue.

Any help is appeciated.

Thanks

AuroraCA 09-23-2008 10:15 PM

Would you copy and paste the precise line which is failing in your crontab file?

Beauford2008 09-23-2008 10:23 PM

Quote:

Originally Posted by AuroraCA (Post 3289837)
Would you copy and paste the precise line which is failing in your crontab file?

There isn't one. What I posted is all I get.

chrism01 09-23-2008 11:58 PM

Post the contents of your script and also the results of

ll /usr/bin/curl

Beauford2008 09-24-2008 09:35 AM

I found some information on this and tried the following in my cron tab:

*/5 * * * * /usr/local/bin/php /usr/home/username/public_html/directory/cron_fivemins.php

Now I get an error that says: no input file found.

Am I on the right track?

Thanks

michaelk 09-24-2008 10:25 AM

Difficult to say without looking at your PHP code. /usr/local/bin/php is for running php scripts via the command line. Does the script run from the command line i.e.
php cron_fivemins.php?

You might need to modify your script somewhat to run via CLI.

DotHQ 09-24-2008 10:34 AM

When I've had this type of error (it runs for me but not for cron) it's normally a permissions issue. What crontab file are you running from? ie: when you modify crontab what is your user ID?

Beauford2008 09-24-2008 12:36 PM

Quote:

Originally Posted by DotHQ (Post 3290423)
When I've had this type of error (it runs for me but not for cron) it's normally a permissions issue. What crontab file are you running from? ie: when you modify crontab what is your user ID?

Not sure, as this is being setup via cpanel from my hosting service, but I agree, it seems to be a permissions issue. I do have limited shell access, but can not create a crontab or view them from the shell.

Beauford2008 09-24-2008 06:10 PM

I found this article and followed the info in it, but still no luck. I also just found out that my hosting does not allow crons under 15 minutes, and I was trying 5. So I am just testing it now with 20 minutes.

http://www.modwest.com/help/kb5-125.html

Working now. Never even thought of something like that from my hosting service. It was just by chance I checked with them.

Thanks for the answers.

chrism01 09-24-2008 07:17 PM

You need a better provider...


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