RE: [PHP] mkdir permission errors
| From: | Robert Cummings | Date: | Mon, 14 Jul 2008 19:59:11 +0000 |
| Subject: | RE: [PHP] mkdir permission errors | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276782@lists.php.net to get a copy of this message | ||
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