• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

httpd php permissions

Linux Fedora C2

I have problems getting a PHP script to write to disk. I  think it's an Apache permission problem. The script is owned by user "user66" and group "group11" so I've changed the httpd.conf file accordingly: User user66 and Group group11.  The script doesn't work, is there something else I have to check about httpd?

Thank you for your help.
3 Solutions
It's probably worth checking the permissions of the directory the files are created in, is the directory writiable by user (user66) or group (group11)?
rblampainAuthor Commented:
Thanks to TomDavidson
Yes, the directories below the current directory are all 777 temporarily.
Do you have the directory in a directory container. EX

<Directory /path/to/script/folder>
   Order Allow, Deny
   Allow from all
Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

rblampainAuthor Commented:
Thanks to pmrussell892
No, the /path/to/script/folder is only mentioned in the following lines in the "httpd.conf" file.  They are listed bellow after trimming of the comment lines. There is also something that puzzles me although it's probably OK:  line 10 below doesn't seem to have a matching preceding <Directory /> tag or is it nested and/or defined in some other way?

1 DocumentRoot "/home/meeting/chair"

 2 <Directory />
 3   Options FollowSymLinks
 4   AllowOverride None
 5 </Directory>

   # This should be ... DocumentRoot to.

 6 <Directory "/home/meeting/chair">
    Options Indexes FollowSymLinks
   # AllowOverride controls what directives ....

 7   AllowOverride None
   # Controls who can get stuff from this server.
 8   Order allow,deny
 9   Allow from all

10 </Directory>

and httpd is running as user66?

check from command line if the script runs
what does your apache's error_log say?
rblampainAuthor Commented:
I found I probably had $_SESSION in the wrong place, I thought it had to be first in the PHP code but it looks like it's got to be first - full stop.
The scripts seems to go a bit further since I made this change ($_SESSION() before PHP and HTML code).
Since changing the user and group httpd runs under made no difference I restored the original values (see below).

Hello ahoffmann, I still have to have a look at the link you gave me.
httpd should be running as "apache" now, the config file is normally for "User apache" and "Group apache"
The script runs and apache gives the following error:
[client] PHP Warning:  chmod(): Operation not permitted in /home/meeting/chair/gedit_file.php on line 25, referer:

I've just made user apache a member of group11 just in case.
rblampainAuthor Commented:
The culprit seems to be SELinux. This is supposed to be "off" by default in the Fedora C2 I'm using but disabling it seems to have solved the problem.
I thank you all in helping to narrow the search for the cause of the problem and I'll allocate the points according to your involvment.
(I should have been a bit more precise in my last post, I meant "session_start", not "$_SESSION")
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now