Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've made another post regarding gitolite that I've resolved already but this is beginning to aggravate me. I can see that my files have read permissions but my error log continues to produce "Permission denied", "Failed opening ... for inclusion", and "Unknown: Failed opening required" errors.

On the website, mchat.php is displaying a blank page. I turned out error reporting but nothing came up.

[Sun Oct 31 17:21:05 2010] [error] [client 76.95.40.61] PHP Warning:
include(./mchat.php) [<a href='function.include'>function.include</a>]
: failed to open stream: Permission denied in /var/www/vhosts/website
.com/httpdocs/index.php on line 267

[Sun Oct 31 17:21:05 2010] [error] [client 76.95.40.61] PHP Warning:
include() [<a href='function.include'>function.include</a>]: Failed op
ening './mchat.php' for inclusion (include_path='.:') in /var/www/vhos
ts/website.com/httpdocs/index.php on line 267

[Sun Oct 31 17:21:07 2010] [error] [client 79.105.140.245] PHP Fatal e
rror:  Unknown: Failed opening required '/var/www/vhosts/website.com/
httpdocs/mchat.php' (include_path='.:') in Unknown on line 0

As you can see, I'm receiving three different errors. Is one of them causing the others?

ls -l returns:

-rw-r--r--  1 git psacln  8824 Oct 31 22:53 index.php
drwxr-xr-x  2 git psacln  4096 Oct 31 22:53 mchat
-rw-r--r--  1 git psacln 38964 Nov  1 00:02 mchat.php

Can anyone help?

share|improve this question
    
Please add output of 'ls -ald /', 'ls -ald /var', 'ls -ald /var/www' upto directory '/var/www/vhosts/website.com'. Also give output of 'getenforce –  Saurabh Barjatiya Nov 8 '10 at 10:05

1 Answer 1

up vote 1 down vote accepted

SELinux might be enabled. Either use

chcon -R -t httptd_sys_content_t <folder>

or

setenforce 0

If you do not use SELinux then you might consider disabling it permanently. Though learning/using it is always a good idea.

share|improve this answer
    
I executed "chcon -R -t httpd_sys_content_t httpdocs" from root and got this: "chcon: httpdocs: Operation not supported" –  Gio Borje Nov 7 '10 at 17:53
    
I just disabled selinux and nothing happened. –  Gio Borje Nov 7 '10 at 22:07
    
Saurabh, your answer worked for my problem. I'm working with CentOS for the first time, and had a problem with a PHP webapp trying to move an uploaded file from /tmp to a directory under /var/mycompany. Calls to move_uploaded_file failed with the message "Permission denied", even though the destination directory existed, and was owned by the user as the httpd process. I invoked setenforce 0, and the problem was solved. I wasn't familiar with SELinux before, and didn't know to check for it. Thanks for the answer! –  Eric Rath Jan 25 '11 at 18:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.