views:

41

answers:

1

I have a Red Hat Linux box that I did not configure but must get a custom PHP application working on it.

This is the error I am getting. I am essentially just trying to include include.php into a file test.php which resides in the same folder. I get the below error.

 Warning: require(include.php) [function.require]: failed to open stream: Permission denied in /var/www/html/test.php  on line 4

    Fatal error: require() [function.require]: Failed opening required 'include.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/test.php on line 4

I have the folder permissions set to 755, the file permissions for each include.php and test.php set to 755. I am not sure what is going on. Anyone have some insight. I have tried looking around for an answer and have only seen file permissions being an aswer for other people which did not work for me.

Thanks for your help.

A: 

Check what are the username and groupname of the apache user on your box and set the owner of your php files accordingly. The following command can help you if your config folder is /etc/httpd :

   grep -rn User /etc/httpd/
greg0ire
httpd as root initially then it will switch. It doesn't say what it will switch to. Does'nt seem to give a group either.
mmundiff
You can see the ps command to see what user/group are launching apache and php processes. You have to make sure that this user or this group can read the file you are attempting to include, by using the chown, chgrp and chmod commands.
greg0ire