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
984 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
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 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now