RE: [PHP] mkdir permission errors
> Nope, I have set mine to 755, and it does not seem to be giving me any > errors. This is the safer way to do it, right? > > Alice Alice, At this point, you need to re-install the OS or prepare to get your machine completely hacked and trashed. With your permissions that badly screwed up, it is only a matter of time before someone finds it and has their own ghost server. First, go pick up a System Admin book for Redhat Second, READ IT, Especially the parts on permissions and changing users Third, Re-install the OS Fourth, read the CLI vs. HTTP differences on programming languages you are using. Obviously Perl and PHP are going to give you the same errors when using the HTTP and will operate differently from the CLI unless running as the same user. This might even help your schooling. Hopefully your classroom exercises are further along then these basic principles, but if not I have severe doubts in anyone graduating with an MIS from Indiana University. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
> > From: Robert Cummings [EMAIL PROTECTED] > Sent: Tuesday, July 15, 2008 12:16 PM > To: Wei, Alice J. > Cc: Peter Ford; php-general@lists.php.net > Subject: RE: [PHP] mkdir permission errors > > On Tue, 2008-07-15 at 08:16 -0400, Wei, Alice J. wrote: > > 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 > > Umm... all your base are bel^H^H^H^H^H^H^H^H^H^H^H^H > > Umm, you've made your entire system world readable/writeable? That's not > good. And the ownership of www is root, not apache. Change directory to > www and do ls -al again. Maybe your html directory is ok for ownerships. > > > 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 error indicates what script is generating the error. Not the path to > the directory you want to create. Maybe echo the name of the directory > you are trying to create when you get a failure for mkdir(). > > Nope, I have set mine to 755, and it does not seem to be giving me any > errors. This is the safer way to do it, right? 755 are better permissions in general than 777, but to what does "mine" refer in the above context? I meant the permission settings have been set to 755 and no longer 777. My mail client? All I can think of is when I am reading others posts and try to answer what they are asking for, which makes it seem like there is a lag. Alice Cheers, Rob. Ps. what's wrong with your mail client? It doesn't quote content to which you reply making it difficult to see where the previous person's post ends and your response begins. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
On Tue, 2008-07-15 at 12:19 -0400, Wei, Alice J. wrote: > > From: Robert Cummings [EMAIL PROTECTED] > Sent: Tuesday, July 15, 2008 12:16 PM > To: Wei, Alice J. > Cc: Peter Ford; php-general@lists.php.net > Subject: RE: [PHP] mkdir permission errors > > On Tue, 2008-07-15 at 08:16 -0400, Wei, Alice J. wrote: > > 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 > > Umm... all your base are bel^H^H^H^H^H^H^H^H^H^H^H^H > > Umm, you've made your entire system world readable/writeable? That's not > good. And the ownership of www is root, not apache. Change directory to > www and do ls -al again. Maybe your html directory is ok for ownerships. > > > 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 error indicates what script is generating the error. Not the path to > the directory you want to create. Maybe echo the name of the directory > you are trying to create when you get a failure for mkdir(). > > Nope, I have set mine to 755, and it does not seem to be giving me any > errors. This is the safer way to do it, right? 755 are better permissions in general than 777, but to what does "mine" refer in the above context? Cheers, Rob. Ps. what's wrong with your mail client? It doesn't quote content to which you reply making it difficult to see where the previous person's post ends and your response begins. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
From: Robert Cummings [EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 12:16 PM To: Wei, Alice J. Cc: Peter Ford; php-general@lists.php.net Subject: RE: [PHP] mkdir permission errors On Tue, 2008-07-15 at 08:16 -0400, Wei, Alice J. wrote: > 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 Umm... all your base are bel^H^H^H^H^H^H^H^H^H^H^H^H Umm, you've made your entire system world readable/writeable? That's not good. And the ownership of www is root, not apache. Change directory to www and do ls -al again. Maybe your html directory is ok for ownerships. > 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 error indicates what script is generating the error. Not the path to the directory you want to create. Maybe echo the name of the directory you are trying to create when you get a failure for mkdir(). Nope, I have set mine to 755, and it does not seem to be giving me any errors. This is the safer way to do it, right? Alice Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
On Tue, 2008-07-15 at 08:16 -0400, Wei, Alice J. wrote: > 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 Umm... all your base are bel^H^H^H^H^H^H^H^H^H^H^H^H Umm, you've made your entire system world readable/writeable? That's not good. And the ownership of www is root, not apache. Change directory to www and do ls -al again. Maybe your html directory is ok for ownerships. > 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 error indicates what script is generating the error. Not the path to the directory you want to create. Maybe echo the name of the directory you are trying to create when you get a failure for mkdir(). Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
On Tue, 2008-07-15 at 09:06 +0100, Peter Ford wrote: > 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 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 > > /usr/sbin/httpd > > root 31708 0.0 0.0 4120 728 pts/1R+ 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 As Scooby would say... "Ruh, Roh!". Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
Daniel Brown <[EMAIL PROTECTED]> wrote: > On Tue, Jul 15, 2008 at 7:05 AM, Wei, Alice J. <[EMAIL PROTECTED]> wrote: > > > > Do I really have to reinstall the entire Fedora? > > You may be a prime candidate for Windows. Well, you *could* load Fedora on another machine, fully update it, and then go into / and do an ls -alF. THEN, on the machine that you have completely messed up the permissions on, you would go to / and do an ls -alF Then traverse the directory structures simultaneously on both machines and make sure the one you messed up matches the pristine installed one. Once you have done that, you should be OK. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
On Tue, Jul 15, 2008 at 7:05 AM, Wei, Alice J. <[EMAIL PROTECTED]> wrote: > > Do I really have to reinstall the entire Fedora? You may be a prime candidate for Windows. -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
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 ?S16:12 0:00 /usr/sbin/httpd apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 /usr/sbin/httpd apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd root 31708 0.0 0.0 4120 728 pts/1R+ 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 ? 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... This sounds really dumb, but it turned out that I have some inconsistencies going on in my httpd.conf file. Now I have changed both groups to daemon, and changed to owners as Rob suggested. Now it is finally working fine. Would I still need to change everything back to 0755? Or, should I ask, what is the appropriate permission I should be using here? Alice At least that explains why the problem arose from a power failure: you had some new settings in the configuration which needed an apache restart to make them happen, and when the server rebooted, apache picked up the new settings... The problem is that if you did "chmod -R 777 /var", you changed every
RE: [PHP] mkdir permission errors
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 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> root 31708 0.0 0.0 4120 728 pts/1R+ 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 ? 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... This sounds really dumb, but it turned out that I have some inconsistencies going on in my httpd.conf file. Now I have changed both
Re: [PHP] mkdir permission errors
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 ?S16:12 0:00 /usr/sbin/httpd apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 /usr/sbin/httpd apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd root 31708 0.0 0.0 4120 728 pts/1R+ 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
RE: [PHP] mkdir permission errors
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 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> root 31708 0.0 0.0 4120 728 pts/1R+ 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 drwx
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 ?S16:12 0:00 /usr/sbin/httpd apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 /usr/sbin/httpd apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd root 31708 0.0 0.0 4120 728 pts/1R+ 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 ? 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 89 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
-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 ?S16:12 0:00 > /usr/sbin/httpd > apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 > /usr/sbin/httpd > apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 > /usr/sbin/httpd > apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 > /usr/sbin/httpd > apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 > /usr/sbin/httpd > apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 > /usr/sbin/httpd > apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 > /usr/sbin/httpd > apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 > /usr/sbin/httpd > root 31708 0.0 0.0 4120 728 pts/1R+ 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 -- Peter Ford phone: 01580 89 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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 ?S16:12 0:00 /usr/sbin/httpd apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 /usr/sbin/httpd apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd root 31708 0.0 0.0 4120 728 pts/1R+ 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... -- Peter Ford phone: 01580 89 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
RE: [PHP] mkdir permission errors
On Mon, 2008-07-14 at 22:09 -0400, Wei, Alice J. wrote: > > This is the output I have got from using your script. > > I have made a following quick change: > > > > [EMAIL PROTECTED] var]# chown -R root:root . > > > > Not surprisingly, I am still not able to make a new directory using PHP > > with the HTTP. > > Could there be anything else I missed? > > I knew who you were when you were on the shell... your ps output showed > the grep process was running as root. But as the others mentioned... > you're running the above script as root. As soon as you go to run via > the webserver things change. In fact, if you run the above as root, and > create any directories, then those will inherit the root ownerships. > Then if you run the same script via the web server, those new > directories may be causing you issues since they trunp the webserver's > permissions. You might want to go do some reading about *nix ownerships > and permissions. It's quite important that you have a thorough > understanding of those if you're going to administer the server. > > Cheers, > Rob. > > The problem here is that the user is not supposed to be doing this from > the client end. What happens here is that they execute a client script, > which then calls the script I have been posting from a different server. > Therefore, my guess is that I can run this "kind of" like in the command > line and access it from the root like where my set up is. > > I can see that I am having a problem here getting the script to work > here. What is interesting is that if my web server is a problem here, > then how is it possible that I am still able to edit the text files I > have already created on this particular machine with the "permission > issues" from a remote server? To get the script to work, do I need to > edit anymore settings on my server? How do you connect via the remote server? Presumably, in each case when you are on the shell, you are the root user. The root user trumps all ownerships and permissions and can do as it pleases. Also, it may be that some of your directory creations are succeeding, while others are failing, depending on the parent directory in which you are attempting to create a sub-directory. You need to simplify the problem, and focus on a single problem directory. Find one directory creation that is failing from the webserver. Then let's deal with it. Determine this single directory that fails due to permissions violations. Then on the shell change to the parent directory. Once there type: ls -al Note the output and the owner/group names. Please post the output. The "." directory is the parent directory when you are within the parent itself. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
> This is the output I have got from using your script. > I have made a following quick change: > > [EMAIL PROTECTED] var]# chown -R root:root . > > Not surprisingly, I am still not able to make a new directory using PHP with > the HTTP. > Could there be anything else I missed? I knew who you were when you were on the shell... your ps output showed the grep process was running as root. But as the others mentioned... you're running the above script as root. As soon as you go to run via the webserver things change. In fact, if you run the above as root, and create any directories, then those will inherit the root ownerships. Then if you run the same script via the web server, those new directories may be causing you issues since they trunp the webserver's permissions. You might want to go do some reading about *nix ownerships and permissions. It's quite important that you have a thorough understanding of those if you're going to administer the server. Cheers, Rob. The problem here is that the user is not supposed to be doing this from the client end. What happens here is that they execute a client script, which then calls the script I have been posting from a different server. Therefore, my guess is that I can run this "kind of" like in the command line and access it from the root like where my set up is. I can see that I am having a problem here getting the script to work here. What is interesting is that if my web server is a problem here, then how is it possible that I am still able to edit the text files I have already created on this particular machine with the "permission issues" from a remote server? To get the script to work, do I need to edit anymore settings on my server? Thanks in advance. Alice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
On Mon, 2008-07-14 at 16:45 -0400, Wei, Alice J. wrote: > Hi, Wolf: > > Like I guessed, I am still defined as the root user. > > [EMAIL PROTECTED] html]# php test.php > root > root/var/www/html > /var/www/html > > This is the output I have got from using your script. > I have made a following quick change: > > [EMAIL PROTECTED] var]# chown -R root:root . > > Not surprisingly, I am still not able to make a new directory using PHP with > the HTTP. > Could there be anything else I missed? I knew who you were when you were on the shell... your ps output showed the grep process was running as root. But as the others mentioned... you're running the above script as root. As soon as you go to run via the webserver things change. In fact, if you run the above as root, and create any directories, then those will inherit the root ownerships. Then if you run the same script via the web server, those new directories may be causing you issues since they trunp the webserver's permissions. You might want to go do some reading about *nix ownerships and permissions. It's quite important that you have a thorough understanding of those if you're going to administer the server. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
Alice: Bottom post like everyone else... "Wei wrote: > Hi, Wolf: > > Like I guessed, I am still defined as the root user. > > [EMAIL PROTECTED] html]# php test.php > root > root/var/www/html > /var/www/html > > This is the output I have got from using your script. > I have made a following quick change: > > [EMAIL PROTECTED] var]# chown -R root:root . > > Not surprisingly, I am still not able to make a new directory using PHP with > the HTTP. > Could there be anything else I missed? > > Alice You are testing from the CLI but trying to run it via HTTP. There IS a difference and continued testing using a different method is going to give you different results... like the following script acts differently depending on where you use it. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
On Mon, Jul 14, 2008 at 4:45 PM, Wei, Alice J. <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] html]# php test.php > root > root/var/www/html > /var/www/html Stop testing from the CLI when you need to see results for HTTP then. -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
On Mon, Jul 14, 2008 at 4:37 PM, Wolf <[EMAIL PROTECTED]> wrote: > > $whoami=system('whoami'); > echo $whoami; > > $pwd=system('pwd'); > echo $pwd; > > That should tell you what ID you are and the path you are in. Conversely, so will this method: -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
Hi, Wolf: Like I guessed, I am still defined as the root user. [EMAIL PROTECTED] html]# php test.php root root/var/www/html /var/www/html This is the output I have got from using your script. I have made a following quick change: [EMAIL PROTECTED] var]# chown -R root:root . Not surprisingly, I am still not able to make a new directory using PHP with the HTTP. Could there be anything else I missed? Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Wolf [EMAIL PROTECTED] Sent: Monday, July 14, 2008 4:37 PM To: Wei, Alice J. Cc: Robert Cummings; php-general@lists.php.net Subject: RE: [PHP] mkdir permission errors "Wei 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 > > 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, $whoami=system('whoami'); echo $whoami; $pwd=system('pwd'); echo $pwd; That should tell you what ID you are and the path you are in. Make sure that the path you are in has the correct permissions. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
"Wei 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 > > 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, $whoami=system('whoami'); echo $whoami; $pwd=system('pwd'); echo $pwd; That should tell you what ID you are and the path you are in. Make sure that the path you are in has the correct permissions. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
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 ?S16:12 0:00 /usr/sbin/httpd apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 /usr/sbin/httpd apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd root 31708 0.0 0.0 4120 728 pts/1R+ 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 [EMAIL PROTECTED] From: Robert Cummings [EMAIL PROTECTED] 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: > > [EMAIL PROTECTED] apache]# ls -la > total 68 > drwxr-xr-x 15 root root4096 2008-06-24 09:36 . > drwxr-xr-x 13 root root4096 2008-07-14 08:53 .. > drwxr-xr-x 2 root root4096 2008-06-24 09:36 bin > drwxr-xr-x 2 root root4096 2008-06-24 09:36 build > drwxr-xr-x 2 root root4096 2008-07-14 08:57 cgi-bin > drwxr-xr-x 4 root root4096 2008-06-25 17:39 conf > drwxr-xr-x 3 root root4096 2008-06-24 09:36 error > drwxr-xr-x 2 apache apache 4096 2008-07-14 15:43 htdocs > drwxr-xr-x 3 root root4096 2008-06-24 09:36 icons > drwxr-xr-x 2 root root4096 2008-06-24 09:36 include > drwxr-xr-x 4 root root4096 2008-06-24 09:36 lib > drwxr-xr-x 2 root root4096 2008-06-27 14:17 logs > drwxr-xr-x 4 root root4096 2008-06-24 09:36 man > drwxr-xr-x 14 root root 12288 2008-06-10 15:18 manual > drwxr-xr-x 2 root root4096 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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: > > [EMAIL PROTECTED] apache]# ls -la > total 68 > drwxr-xr-x 15 root root4096 2008-06-24 09:36 . > drwxr-xr-x 13 root root4096 2008-07-14 08:53 .. > drwxr-xr-x 2 root root4096 2008-06-24 09:36 bin > drwxr-xr-x 2 root root4096 2008-06-24 09:36 build > drwxr-xr-x 2 root root4096 2008-07-14 08:57 cgi-bin > drwxr-xr-x 4 root root4096 2008-06-25 17:39 conf > drwxr-xr-x 3 root root4096 2008-06-24 09:36 error > drwxr-xr-x 2 apache apache 4096 2008-07-14 15:43 htdocs > drwxr-xr-x 3 root root4096 2008-06-24 09:36 icons > drwxr-xr-x 2 root root4096 2008-06-24 09:36 include > drwxr-xr-x 4 root root4096 2008-06-24 09:36 lib > drwxr-xr-x 2 root root4096 2008-06-27 14:17 logs > drwxr-xr-x 4 root root4096 2008-06-24 09:36 man > drwxr-xr-x 14 root root 12288 2008-06-10 15:18 manual > drwxr-xr-x 2 root root4096 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
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: [EMAIL PROTECTED] apache]# ls -la total 68 drwxr-xr-x 15 root root4096 2008-06-24 09:36 . drwxr-xr-x 13 root root4096 2008-07-14 08:53 .. drwxr-xr-x 2 root root4096 2008-06-24 09:36 bin drwxr-xr-x 2 root root4096 2008-06-24 09:36 build drwxr-xr-x 2 root root4096 2008-07-14 08:57 cgi-bin drwxr-xr-x 4 root root4096 2008-06-25 17:39 conf drwxr-xr-x 3 root root4096 2008-06-24 09:36 error drwxr-xr-x 2 apache apache 4096 2008-07-14 15:43 htdocs drwxr-xr-x 3 root root4096 2008-06-24 09:36 icons drwxr-xr-x 2 root root4096 2008-06-24 09:36 include drwxr-xr-x 4 root root4096 2008-06-24 09:36 lib drwxr-xr-x 2 root root4096 2008-06-27 14:17 logs drwxr-xr-x 4 root root4096 2008-06-24 09:36 man drwxr-xr-x 14 root root 12288 2008-06-10 15:18 manual drwxr-xr-x 2 root root4096 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 [EMAIL PROTECTED] From: Robert Cummings [EMAIL PROTECTED] 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: > > [EMAIL PROTECTED] 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 ?S14:27 0:00 > /usr/sbin/httpd > apache 30960 0.0 0.3 27576 6800 ?S14:27 0:00 > /usr/sbin/httpd > apache 30961 0.0 0.3 27576 6800 ?S14:27 0:00 > /usr/sbin/httpd > apache 30962 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > apache 30963 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > apache 30964 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > apache 30965 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > apache 30966 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > root 31299 0.0 0.0 4120 676 pts/1R+ 15:36 0:00 grep -E > apache|httpd > [EMAIL PROTECTED] 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 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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: > > [EMAIL PROTECTED] 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 ?S14:27 0:00 > /usr/sbin/httpd > apache 30960 0.0 0.3 27576 6800 ?S14:27 0:00 > /usr/sbin/httpd > apache 30961 0.0 0.3 27576 6800 ?S14:27 0:00 > /usr/sbin/httpd > apache 30962 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > apache 30963 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > apache 30964 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > apache 30965 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > apache 30966 0.0 0.3 27576 6788 ?S14:27 0:00 > /usr/sbin/httpd > root 31299 0.0 0.0 4120 676 pts/1R+ 15:36 0:00 grep -E > apache|httpd > [EMAIL PROTECTED] 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 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
Hi, Rob: Here is the updated version from the correct command: [EMAIL PROTECTED] 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 ?S14:27 0:00 /usr/sbin/httpd apache 30960 0.0 0.3 27576 6800 ?S14:27 0:00 /usr/sbin/httpd apache 30961 0.0 0.3 27576 6800 ?S14:27 0:00 /usr/sbin/httpd apache 30962 0.0 0.3 27576 6788 ?S14:27 0:00 /usr/sbin/httpd apache 30963 0.0 0.3 27576 6788 ?S14:27 0:00 /usr/sbin/httpd apache 30964 0.0 0.3 27576 6788 ?S14:27 0:00 /usr/sbin/httpd apache 30965 0.0 0.3 27576 6788 ?S14:27 0:00 /usr/sbin/httpd apache 30966 0.0 0.3 27576 6788 ?S14:27 0:00 /usr/sbin/httpd root 31299 0.0 0.0 4120 676 pts/1R+ 15:36 0:00 grep -E apache|httpd [EMAIL PROTECTED] htdocs]# Does this suggest anything? Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Robert Cummings [EMAIL PROTECTED] Sent: Monday, July 14, 2008 3:35 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: RE: [PHP] mkdir permission errors On Mon, 2008-07-14 at 15:23 -0400, Wei, Alice J. wrote: > Hi, Rob: > > This is the output: > > root 31232 0.0 0.0 4120 672 pts/1R+ 15:22 0:00 grep > apache|httpd > > Does this help? Sorry... my bad, can you do the following: ps awxu | grep -E 'apache|httpd' I have grep aliased on my system so the -E flag is automatically added :) Thanks, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
On Mon, 2008-07-14 at 15:23 -0400, Wei, Alice J. wrote: > Hi, Rob: > > This is the output: > > root 31232 0.0 0.0 4120 672 pts/1R+ 15:22 0:00 grep > apache|httpd > > Does this help? Sorry... my bad, can you do the following: ps awxu | grep -E 'apache|httpd' I have grep aliased on my system so the -E flag is automatically added :) Thanks, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
Hi, Rob: This is the output: root 31232 0.0 0.0 4120 672 pts/1R+ 15:22 0:00 grep apache|httpd Does this help? Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Robert Cummings [EMAIL PROTECTED] Sent: Monday, July 14, 2008 3:21 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: RE: [PHP] mkdir permission errors On Mon, 2008-07-14 at 15:11 -0400, Wei, Alice J. wrote: > Hi, > >The apache is running currently on root as the user. >The parent directory, test, is set to 0755. >I have no problems making new directories directly from the terminal > prompt, and it does not give me user execution errors like the one in the > following. >I am getting confused with why I can create directories now no longer > through the PHP but only through the command prompt manually. > > Does this give you information on what my problem might be? Can you post the following command's output to the list or me personally if you think it's sensitive: ps awxu | grep 'apache|httpd' If apache is running as root as you say then it shouldn't have any problems doing anything (that's a very dangerous way to run apache btw). So either apache isn't running as root (maybe you think invoking the daemon causes it to run as root -- it doesn't), or PHP itself is causing the access denied problem (safe mode? base dir?). Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
On Mon, 2008-07-14 at 15:11 -0400, Wei, Alice J. wrote: > Hi, > >The apache is running currently on root as the user. >The parent directory, test, is set to 0755. These are permissions btw, and not ownerships. Ownerships denote user and group owners of the directory... specifically the entities to which the 75 permissions are assigned shown above. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
On Mon, 2008-07-14 at 15:11 -0400, Wei, Alice J. wrote: > Hi, > >The apache is running currently on root as the user. >The parent directory, test, is set to 0755. >I have no problems making new directories directly from the terminal > prompt, and it does not give me user execution errors like the one in the > following. >I am getting confused with why I can create directories now no longer > through the PHP but only through the command prompt manually. > > Does this give you information on what my problem might be? Can you post the following command's output to the list or me personally if you think it's sensitive: ps awxu | grep 'apache|httpd' If apache is running as root as you say then it shouldn't have any problems doing anything (that's a very dangerous way to run apache btw). So either apache isn't running as root (maybe you think invoking the daemon causes it to run as root -- it doesn't), or PHP itself is causing the access denied problem (safe mode? base dir?). Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
Hi, The apache is running currently on root as the user. The parent directory, test, is set to 0755. I have no problems making new directories directly from the terminal prompt, and it does not give me user execution errors like the one in the following. I am getting confused with why I can create directories now no longer through the PHP but only through the command prompt manually. Does this give you information on what my problem might be? Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] From: Robert Cummings [EMAIL PROTECTED] Sent: Monday, July 14, 2008 3:07 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: Re: [PHP] mkdir permission errors On Mon, 2008-07-14 at 15:01 -0400, Wei, Alice J. wrote: > Hi, Guys: > >I have a very strange incident here that may seem very stupid. Since the > power went out last night, I have restarted my server. However, now the > permission is never working right. I have set the permission of my htdocs > folder iof my Apache server to 0755, and then started executing the following. > > $id=$_REQUEST['id']; > $filename = "/usr/local/apache/htdocs/test"; > > if (file_exists($filename)) { > > mkdir("/usr/local/apache/htdocs/test/$id", 0777) or die ("Cannot > create directory"); > chmod("/usr/local/apache/htdocs/test/$id", 0777); > mkdir("/usr/local/apache/htdocs/test/$id/contours", 0755) or die > ("Cannot create directory"); > chmod ("/usr/local/apache/htdocs/test/$id/contours",0777); > mkdir ("/usr/local/apache/htdocs//$id/beamdata", 0777) or die > ("Cannot create directory"); > mkdir("/usr/local/apache/htdocs//$id/schemadata", 0777) or die > ("Cannot create directory"); > mkdir("/usr/local/apache/htdocs/$id/plandata", 0777) or die ("Cannot > create directory"); > > } > > else { > > mkdir("/usr/local/apache/htdocs/test", 0777) or die ("Cannot create > directory http://192.168.10.63/TPU"); > } > > However, the error always bumped me with Cannot create directory > http://192.168.10.63/test. > I went into my error logs, and it continuously give me this: > > [Mon Jul 14 14:51:07 2008] [error] [client 192.168.10.63] PHP Warning: > mkdir() [function.mkdir]: Permission denied in > /usr/local/apache/htdocs/file_linux.php on line 23 > > Can anyone please give me a hint on what could be wrong here? I have set my > parent directory to 0755 already. Under what user does apache run? What are the ownerships on the parent directory? Can you create the directory if you log in as the apache user (su apacheuser)? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
On Mon, 2008-07-14 at 15:01 -0400, Wei, Alice J. wrote: > Hi, Guys: > >I have a very strange incident here that may seem very stupid. Since the > power went out last night, I have restarted my server. However, now the > permission is never working right. I have set the permission of my htdocs > folder iof my Apache server to 0755, and then started executing the following. > > $id=$_REQUEST['id']; > $filename = "/usr/local/apache/htdocs/test"; > > if (file_exists($filename)) { > > mkdir("/usr/local/apache/htdocs/test/$id", 0777) or die ("Cannot > create directory"); > chmod("/usr/local/apache/htdocs/test/$id", 0777); > mkdir("/usr/local/apache/htdocs/test/$id/contours", 0755) or die > ("Cannot create directory"); > chmod ("/usr/local/apache/htdocs/test/$id/contours",0777); > mkdir ("/usr/local/apache/htdocs//$id/beamdata", 0777) or die > ("Cannot create directory"); > mkdir("/usr/local/apache/htdocs//$id/schemadata", 0777) or die > ("Cannot create directory"); > mkdir("/usr/local/apache/htdocs/$id/plandata", 0777) or die ("Cannot > create directory"); > > } > > else { > > mkdir("/usr/local/apache/htdocs/test", 0777) or die ("Cannot create > directory http://192.168.10.63/TPU"); > } > > However, the error always bumped me with Cannot create directory > http://192.168.10.63/test. > I went into my error logs, and it continuously give me this: > > [Mon Jul 14 14:51:07 2008] [error] [client 192.168.10.63] PHP Warning: > mkdir() [function.mkdir]: Permission denied in > /usr/local/apache/htdocs/file_linux.php on line 23 > > Can anyone please give me a hint on what could be wrong here? I have set my > parent directory to 0755 already. Under what user does apache run? What are the ownerships on the parent directory? Can you create the directory if you log in as the apache user (su apacheuser)? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php