Linux file permissions preventing PHP include from appearing?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Linux file permissions preventing PHP include from appearing?
On a RedHat server, there is a main php page that calls a php include file (a site footer) from the same directory.
The main php page opens fine. However the footer is not appearing despite the fact that the file is on the server.
The group name for the footer is for some reason different than the group name of the main php page.
My question is could having a different group name, or different file permissions, prevent a php file from being loaded as an include from within another php file?
I've double-checked the source of the main php file and the include is there and there is no php error. Just trying to determine if it's a Linux permissions issue.
Please show full ownerships and perms on both file using 'ls -l' and also show the user+group Apache is running as.
You should also look into the Apache error_log.
It's been ages since I played with PHP, but I seem to recall that if safe_mode was turned on, PHP would only process include files if the file being included was in a certain directory or set of directories. You might want to check your php.ini and see if this feature is enabled. Checking the Apache error_log as mentioned above is also a good idea.
Thanks for the ideas, folks! The problem is fixed, though it's still not entirely clear to me why...
Safe_mode is off.
I checked the /var/log/httpd/error_log file and there is this permission error:
"PHP Warning: include...failed to open stream: Permission denied."
I changed the group name for the include file to match the group name for the main php file and this fixed the problem. Didn't change the file permissions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.