We help IT Professionals succeed at work.
Get Started

permission denied to run cron job

ksdean
ksdean asked
on
1,022 Views
Last Modified: 2012-05-09
I have a cron job that I want to run at 12:01 every night to update all the records in one filed of a table in a database. Currently I am getting an error when the cron job runs saying permission denied. Here is the exact text of the error (with the path changed):

/bin/sh: /xxxxxxx/homepages/33/xxxxxxx/htdocs/xxxxxxxx.php: Permission denied

This is how I have it set up:
the cron job calls the php file.
I have an require once in the php file to connect to the database
then the php file runs

I suspect that the permission denied error is coming because the user name is the username of the database, not the root user of the shell. Do I need to add a user login to my php file for the shell access? If so, how would I go about doing that?

I know the php file is running correctly because when I run it manually, it does what I want it to do.
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE