RE: [PHP] mkdir permission errors
| From: | Wei, Alice J. | Date: | Mon, 14 Jul 2008 20:32:38 +0000 |
| Subject: | RE: [PHP] mkdir permission errors | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276792@lists.php.net to get a copy of this message | ||
Hi, Rob:
I forgot to mention that I have been using yum install.
I have reinstalled the entire thing, put back all the packages, and then I went to /var and did a
chmod -R 777 var, and then did a
[root@localhost var]# chown -R apache:apache .
Interestingly, I do not see anything different, and I still get this error that says my permission
is denied. Here is my
[root@localhost var]# ps awxu | grep -E 'apache|httpd'
root 31547 0.0 0.3 21268 6584 ? Ss 16:12 0:00 /usr/sbin/httpd
apache 31549 0.0 0.2 21400 5572 ? S 16:12 0:00 /usr/sbin/httpd
apache 31550 0.0 0.2 21400 4908 ? S 16:12 0:00 /usr/sbin/httpd
apache 31551 0.0 0.2 21400 4908 ? S 16:12 0:00 /usr/sbin/httpd
apache 31552 0.0 0.2 21400 4896 ? S 16:12 0:00 /usr/sbin/httpd
apache 31553 0.0 0.2 21268 4860 ? S 16:12 0:00 /usr/sbin/httpd
apache 31554 0.0 0.2 21268 4860 ? S 16:12 0:00 /usr/sbin/httpd
apache 31555 0.0 0.2 21268 4860 ? S 16:12 0:00 /usr/sbin/httpd
apache 31556 0.0 0.2 21268 4860 ? S 16:12 0:00 /usr/sbin/httpd
root 31708 0.0 0.0 4120 728 pts/1 R+ 16:30 0:00 grep -E apache|httpd
Obviously, my last one has already changed the owner to apache already.Nevertheless, I am still
denied even when I am now logged in as root. Is this anything with firewalls?
Thanks for your help.
Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu
________________________________________
From: Robert Cummings [robert@interjinn.com]
Sent: Monday, July 14, 2008 3:59 PM
To: Wei, Alice J.
Cc: php-general@lists.php.net
Subject: RE: [PHP] mkdir permission errors
On Mon, 2008-07-14 at 15:49 -0400, Wei, Alice J. wrote:
> Hi, Rob:
>
> I did follow the instruction of putting in chown apache:apache htdocs. Now when I run the ls
> -la command, I get this:
>
> [root@localhost apache]# ls -la
> total 68
> drwxr-xr-x 15 root root 4096 2008-06-24 09:36 .
> drwxr-xr-x 13 root root 4096 2008-07-14 08:53 ..
> drwxr-xr-x 2 root root 4096 2008-06-24 09:36 bin
> drwxr-xr-x 2 root root 4096 2008-06-24 09:36 build
> drwxr-xr-x 2 root root 4096 2008-07-14 08:57 cgi-bin
> drwxr-xr-x 4 root root 4096 2008-06-25 17:39 conf
> drwxr-xr-x 3 root root 4096 2008-06-24 09:36 error
> drwxr-xr-x 2 apache apache 4096 2008-07-14 15:43 htdocs
> drwxr-xr-x 3 root root 4096 2008-06-24 09:36 icons
> drwxr-xr-x 2 root root 4096 2008-06-24 09:36 include
> drwxr-xr-x 4 root root 4096 2008-06-24 09:36 lib
> drwxr-xr-x 2 root root 4096 2008-06-27 14:17 logs
> drwxr-xr-x 4 root root 4096 2008-06-24 09:36 man
> drwxr-xr-x 14 root root 12288 2008-06-10 15:18 manual
> drwxr-xr-x 2 root root 4096 2008-06-24 09:44 modules
>
> However, this does not change any of the errors I have been getting by executing my PHP code. I
> still get
>
> Warning: chmod() [function.chmod]: Permission denied in /usr/local/apache/htdocs/file_linux.php
> on line 27
>
> Is this what I should be having in my ownership of the files?
Well it depends... if that is the exact parent where you are making the
new directory then it should work. But it's not... you are doing it in
the subdirectory "test", or "test/$id" or "test/$id/$somethingelse".
It
seems to do it recursively:
chown -R apache:apache htdocs
Note: this will recursively descend into htdocs and change the
permissions on every file directory and file found. You may want to
limit this to directories only:
chown apache:apache htdocs
cd htdocs
chown apache:apache
find -type d
You may not want this level of ownership change at all. You might just
want to target the appropriate directories. In which case issue chown
for each directory in question.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP