LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 12-06-2012, 10:35 AM   #1
misterpiddles
LQ Newbie
 
Registered: Nov 2012
Location: Boston-ish, MA, USA
Distribution: Debian
Posts: 17

Rep: Reputation: Disabled
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.
 
Old 12-06-2012, 10:39 AM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,977
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
What are the permissions? As long as the apache user has "read" is should be okay.

Also, are you using SELinux? Improper File Context can also hinder functionality

--C
 
Old 12-06-2012, 10:46 AM   #3
misterpiddles
LQ Newbie
 
Registered: Nov 2012
Location: Boston-ish, MA, USA
Distribution: Debian
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by custangro View Post
What are the permissions? As long as the apache user has "read" is should be okay.

Also, are you using SELinux? Improper File Context can also hinder functionality

--C
Main php file:
owner, group: masterowner

Include php file:
owner, group: grpit
File permissions: r--r--r--

If I run this command to determine group access for 'masterowner' I get:
grep ^masterowner /etc/group
masterowner:x:10030:grpit

So, I read this as the 'grpit' group should have the same permissions as the 'masterowner' group. Is this a correct interpretation?

I'm a newb, so I'm not sure what SELinux is, sorry...

Last edited by misterpiddles; 12-06-2012 at 10:52 AM.
 
Old 12-06-2012, 11:24 AM   #4
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,977
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
What's the output of...

Code:
getenforce
Code:
sealert -a /var/log/audit/audit.log
--C
 
Old 12-06-2012, 11:33 AM   #5
misterpiddles
LQ Newbie
 
Registered: Nov 2012
Location: Boston-ish, MA, USA
Distribution: Debian
Posts: 17

Original Poster
Rep: Reputation: Disabled
I got "Disabled" after running getenforce.

I got "-bash: sealert: command not found" after running the selinux command.
 
Old 12-06-2012, 11:39 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
Quote:
Originally Posted by custangro View Post
Also, are you using SELinux? Improper File Context can also hinder functionality
MAC works on top of DAC, so I'd have the OP check the web servers access and error log for perm probs first.
 
Old 12-06-2012, 10:55 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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.
 
Old 12-06-2012, 10:58 PM   #8
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
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.
 
Old 12-07-2012, 10:55 AM   #9
misterpiddles
LQ Newbie
 
Registered: Nov 2012
Location: Boston-ish, MA, USA
Distribution: Debian
Posts: 17

Original Poster
Rep: Reputation: Disabled
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Problem with file permissions in PHP on Linux luismartin Programming 8 03-15-2012 05:38 AM
PHP include file directory/paths DMeerholz Linux - Software 1 07-02-2007 10:21 AM
www-data group not appearing in file permissions tab nick1 Ubuntu 1 05-01-2006 11:48 AM
PHP include() file paths in Apache virtual hosts tawalker Linux - Software 0 09-23-2004 02:16 PM
how do I chown a PHP file on /usr/ to allow EVERYONE to include it? cpanelskindepot Programming 2 07-16-2004 03:36 PM


All times are GMT -5. The time now is 01:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration