RE: [PHP] mkdir permission errors
| From: | Wei, Alice J. | Date: | Mon, 14 Jul 2008 19:49:43 +0000 |
| Subject: | RE: [PHP] mkdir permission errors | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276778@lists.php.net to get a copy of this message | ||
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?
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:42 PM
To: Wei, Alice J.
Cc: php-general@lists.php.net
Subject: RE: [PHP] mkdir permission errors
On Mon, 2008-07-14 at 15:37 -0400, Wei, Alice J. wrote:
> Hi, Rob:
>
> Here is the updated version from the correct command:
>
> [root@localhost htdocs]# ps awxu | grep -E 'apache|httpd'
> root 30957 0.0 0.5 27576 11016 ? Ss 14:27 0:00 /usr/sbin/httpd
> apache 30959 0.0 0.3 27708 7452 ? S 14:27 0:00 /usr/sbin/httpd
> apache 30960 0.0 0.3 27576 6800 ? S 14:27 0:00 /usr/sbin/httpd
> apache 30961 0.0 0.3 27576 6800 ? S 14:27 0:00 /usr/sbin/httpd
> apache 30962 0.0 0.3 27576 6788 ? S 14:27 0:00 /usr/sbin/httpd
> apache 30963 0.0 0.3 27576 6788 ? S 14:27 0:00 /usr/sbin/httpd
> apache 30964 0.0 0.3 27576 6788 ? S 14:27 0:00 /usr/sbin/httpd
> apache 30965 0.0 0.3 27576 6788 ? S 14:27 0:00 /usr/sbin/httpd
> apache 30966 0.0 0.3 27576 6788 ? S 14:27 0:00 /usr/sbin/httpd
> root 31299 0.0 0.0 4120 676 pts/1 R+ 15:36 0:00 grep -E apache|httpd
> [root@localhost htdocs]#
>
> Does this suggest anything?
Yep, apache is not running as root. It is running as user apache. Now go
to the parent directory and input the following command:
chown apache:apache <directoryName>
That will change the ownership/group to apache. And then apache can
write to it.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP