Re: [PHP] mkdir permission errors
- From: pete@xxxxxxxxxxxxx (Peter Ford)
- Date: Tue, 15 Jul 2008 12:28:52 +0100
Wei, Alice J. wrote:
From: Peter Ford [mailto:pete@xxxxxxxxxxxxx]
Sent: Tuesday, July 15, 2008 4:06 AM
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
[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?
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.
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
And does your PHP script have the correct path?
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?). 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...
Peter Ford, Developer phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd. www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS
- Re: [PHP] mkdir permission errors
- From: Peter Ford
- Re: [PHP] mkdir permission errors