While working on an internal project I noticed that the php file() function was not able to open a file and dump the contents into a variable. After moving the file to a different directory the PHP script was able to read the file. In addition to this side affect, accessing files through
I first noticed some images not displaying on a web site that were correctly linked to. Looking at the error_log, I saw entries such as:
[Tue Jan 13 12:03:53 2009] [crit] [client XX.XXX.XXX.XX] (13)Permission denied: /var/www/vhosts/domainname.com/httpdocs/site/articles/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: http://www.domainname.com/file.php
This error message is pointless and more than misleading as I had no .htaccess file in the directory. Upon investigation saw that I had chmoded the folder to 644. Directories need to have the execute bit set so that we have the permissions to traverse the directory tree in order to access files.
To correct the error I set the folder to
chmod 755 foldername
, the images appeared again and the error message stopped appearing in the logs.