?
Solved

I am recieving this error (Warning: chdir(): Permission denied (errno 13)) when I run a php file as a cron job in CentOS

Posted on 2008-10-24
3
Medium Priority
?
1,069 Views
Last Modified: 2013-12-16
I created a cron job in cPanel (CentOS) to run a php file every hour.  It was going fine, until one hour it began returning this error.  I set the permissions for that file to 777, but that didn't resolve it.  I also tried taking ownership of public_html with the nobody account, which also didn't work.  What am I missing here?  Do cPanel cron jobs run as a special user?
0
Comment
Question by:ti57
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 27

Expert Comment

by:caterham_www
ID: 22800597
SELinux may "cause" permission errors, too, but since it worked before... hmmm
0
 

Author Comment

by:ti57
ID: 22800667
How?
0
 
LVL 7

Accepted Solution

by:
macker- earned 2000 total points
ID: 22837245
selinux is a kernel level mechanism that allows you to set a policy for a piece of software, like Apache, and dictate what files it can/cannot touch.

Since this is a php script running from cron, it's unlikely it's an SELinux policy.

If the file is permission 777, then anyone can write to it, regardless of user.  However, not anyone can delete it, only the owner can.

This sounds like the parent directory, or one of the parent directories, has the wrong permissions on it.  Check the hierarchy, probably something up north was modified to turn off the bit, e.g. the read/execute bit is no longer set.

The nobody account has no special meaning, unlike root; only the "root" and "nobody" user can write to a file owned by "nobody", unless group/world permissions allow it.  Check that the home directory, which the public_html directory is contained within, isn't 750 ("drwxr-x---") or similar; it must at least "dr-xr-xr-x" all the way up, unless there's a group that matches, with correct group permissions.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question