Wei, Alice J. wrote:
From: Peter Ford [EMAIL PROTECTED]
Sent: Tuesday, July 15, 2008 7:28 AM
To: Wei, Alice J.
Cc: php-general@lists.php.net
Subject: Re: [PHP] mkdir permission errors

Wei, Alice J. wrote:
-----Original Message-----
From: Peter Ford [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 15, 2008 4:06 AM
To: php-general@lists.php.net
Subject: Re: [PHP] mkdir permission errors

Wei, Alice J. wrote:
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

   [EMAIL PROTECTED] 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

[EMAIL PROTECTED] 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?

Hang on a minute: you're original message said the error was:

Warning: chmod() [function.chmod]: Permission denied in
/usr/local/apache/htdocs/file_linux.php on line 27

But you say you've re-installed, and done "chmod -R 777 var" and "chown -R
apache:apache ." in /var

A few things there:
When you are changing permissions and ownerships on such a large scale, you
should always use absolute paths to be sure you are doing the right thing - like
"chmod -R 777 /var" and "chown -R apache:apache /var"

Next, changing permission and ownership recursively on something like /var is
likely to wreck your system in weird and wonderful ways, and is pretty difficult
to undo - you might be looking at a total OS reinstall here (once you've solved
your Apache problems)

Finally, the error message refers to a file in /usr/local/apache/htdocs, but you
then are changing permissions in /var - where is your web root?! It looks like
your PHP code has the /usr/local/apache/htdocs path hard-coded, when your web
files are actually in /var/something...

I forgot to mention that I use Fedora on a Linux machine. I used yum install 
apache and yum install php to install my packages. Therefore, I don't have a 
/usr/local/apache/htdocs folder. The web root is now /var/www/html, which 
originally I do have /usr/local/apache/htdocs that I configured during previous 
installations. This is not there anymore after my reinstallations since 
yesterday.

Do I really have to reinstall the entire Fedora? I hate to say that my scripts 
worked fine BEFORE yesterday until the power went out and nothing went right 
after I have restarted the entire system.

Alice


You don't *have* to reinstall Fedora (yet) - that was just a warning that
changing ownership and permissions on /var might cause some problems later...

So the question is, does the error message say that it cannot change 
permissions on
        /usr/local/apache/htdocs/file_linux.php
or
         /var/www/html/file_linux.php
?

This portion is to answer Rob's question:

[EMAIL PROTECTED] var]# ls -la
total 92
drwxrwxrwx 22 root root 4096 2008-06-24 08:34 .
drwxr-xr-x 21 root root 4096 2008-07-14 08:17 ..
drwxrwxrwx  2 root root 4096 2008-06-24 08:25 account
drwxrwxrwx 13 root root 4096 2008-07-14 16:07 cache
drwxrwxrwx  2 root root 4096 2008-02-19 20:47 cvs
drwxrwxrwx  3 root root 4096 2008-06-24 08:25 db
drwxrwxrwx  3 root root 4096 2008-06-24 08:29 empty
drwxrwxrwx  2 root root 4096 2008-04-07 17:44 games
drwxrwxrwx  2 root root 4096 2008-05-01 22:45 gdm
drwxrwxrwx 35 root root 4096 2008-07-14 16:07 lib
drwxrwxrwx  2 root root 4096 2008-04-07 17:44 local
drwxrwxrwx  5 root root 4096 2008-07-15 04:10 lock
drwxrwxrwx 17 root root 4096 2008-07-15 04:10 log
lrwxrwxrwx  1 root root   10 2008-06-24 08:24 mail -> spool/mail
drwxrwxrwx  6 root root 4096 2008-06-24 08:26 named
drwxrwxrwx  2 root root 4096 2008-04-07 17:44 nis
drwxrwxrwx  2 root root 4096 2008-04-07 17:44 opt
drwxrwxrwx  2 root root 4096 2008-04-07 17:44 preserve
drwxrwxrwx 27 root root 4096 2008-07-14 16:12 run
drwxrwxrwx 13 root root 4096 2008-06-24 08:35 spool
drwxrwxrwx  2 root root 4096 2008-07-14 16:10 tmp
drwxrwxrwx  8 root root 4096 2008-07-14 16:07 www
drwxrwxrwx  3 root root 4096 2008-06-24 08:29 yp

And does your PHP script have the correct path?

This is the latest error I got:

Warning: mkdir() [function.mkdir]: Permission denied in 
/var/www/html/file_linux.php on line 15
Cannot create directory

The original problem may just have been that the /usr/local file system was
mounted read-only after the power outage (perhaps due to some disk corruption
caused by the failure?).

  I have thought about that, and have restarted Apache that time, but somehow 
that did not work. I am not sure if that had been the right procedures of what 
I took.

Since then you have reinstalled apache, but possibly
not in the place your PHP script expects it to be. That would be my first thing
to check...

  It appears to me that when I opened up the page with phpinfo(), it does 
display the accurate information. But from what you said here, are there other 
things I must do to check if it is working as it is?

Thanks in advance.
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]
________________________________________


I'm being a bit of an idiot, but I realised that the path in the error message is NOT the path being created, but the path of the script.
Back to your first post - you posted some PHP which included something like:

mkdir("/usr/local/apache/htdocs/test/$id", 0777) or die ("<p>Cannot create directory</p>");

The questions are these:

is your /var/www/html/file_linux.php script trying to create /usr/local/apache/htdocs/test/$id ?

And does the directory /usr/local/apache/htdocs/test/ exist on your server?



--
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to