LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 09-23-2008, 09:49 PM   #1
Beauford2008
LQ Newbie
 
Registered: Sep 2008
Posts: 28

Rep: Reputation: 0
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

Last edited by Beauford2008; 09-23-2008 at 10:14 PM.
 
Old 09-23-2008, 10:15 PM   #2
AuroraCA
Member
 
Registered: Jul 2008
Location: Northern CA USA
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370

Rep: Reputation: 35
Would you copy and paste the precise line which is failing in your crontab file?
 
Old 09-23-2008, 10:23 PM   #3
Beauford2008
LQ Newbie
 
Registered: Sep 2008
Posts: 28

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by AuroraCA View Post
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.

Last edited by Beauford2008; 09-23-2008 at 10:24 PM.
 
Old 09-23-2008, 11:58 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5
Posts: 16,086

Rep: Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995
Post the contents of your script and also the results of

ll /usr/bin/curl
 
Old 09-24-2008, 09:35 AM   #5
Beauford2008
LQ Newbie
 
Registered: Sep 2008
Posts: 28

Original Poster
Rep: Reputation: 0
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
 
Old 09-24-2008, 10:25 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,541

Rep: Reputation: 676Reputation: 676Reputation: 676Reputation: 676Reputation: 676Reputation: 676
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.
 
Old 09-24-2008, 10:34 AM   #7
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 542

Rep: Reputation: 33
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?
 
Old 09-24-2008, 12:36 PM   #8
Beauford2008
LQ Newbie
 
Registered: Sep 2008
Posts: 28

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by DotHQ View Post
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.
 
Old 09-24-2008, 06:10 PM   #9
Beauford2008
LQ Newbie
 
Registered: Sep 2008
Posts: 28

Original Poster
Rep: Reputation: 0
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.

Last edited by Beauford2008; 09-24-2008 at 06:47 PM.
 
Old 09-24-2008, 07:17 PM   #10
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5
Posts: 16,086

Rep: Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995
You need a better provider...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql replication: Error running query on master: Access denied; RKris Linux - Software 1 06-19-2011 04:14 PM
Errors when running Perl script in a cron job meshach Slackware 2 06-20-2006 09:10 PM
mysql/php access denied error Chuck23 Linux - Software 3 02-15-2005 06:36 PM
Cron Job not running ssh script karim0028 Linux - General 3 02-07-2005 12:08 PM
script not running as a cron job sanjith11 Programming 5 11-23-2004 08:42 AM


All times are GMT -5. The time now is 12:23 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration