|
From: "Wei, Alice J." on 14 Jul 2008 15:01 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 ("<p>Cannot create directory</p>"); chmod("/usr/local/apache/htdocs/test/$id", 0777); mkdir("/usr/local/apache/htdocs/test/$id/contours", 0755) or die ("<p>Cannot create directory</p>"); chmod ("/usr/local/apache/htdocs/test/$id/contours",0777); mkdir ("/usr/local/apache/htdocs//$id/beamdata", 0777) or die ("<p>Cannot create directory</p>"); mkdir("/usr/local/apache/htdocs//$id/schemadata", 0777) or die ("<p>Cannot create directory</p>"); mkdir("/usr/local/apache/htdocs/$id/plandata", 0777) or die ("<p>Cannot create directory</p>"); } else { mkdir("/usr/local/apache/htdocs/test", 0777) or die ("<p>Cannot create directory http://192.168.10.63/TPU</p>"); } 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() [<a href='function.mkdir'>function.mkdir</a>]: 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. Thanks in advance. ====================================================== Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington ajwei(a)indiana.edu
From: Robert Cummings on 14 Jul 2008 15:07 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 ("<p>Cannot create directory</p>"); > chmod("/usr/local/apache/htdocs/test/$id", 0777); > mkdir("/usr/local/apache/htdocs/test/$id/contours", 0755) or die ("<p>Cannot create directory</p>"); > chmod ("/usr/local/apache/htdocs/test/$id/contours",0777); > mkdir ("/usr/local/apache/htdocs//$id/beamdata", 0777) or die ("<p>Cannot create directory</p>"); > mkdir("/usr/local/apache/htdocs//$id/schemadata", 0777) or die ("<p>Cannot create directory</p>"); > mkdir("/usr/local/apache/htdocs/$id/plandata", 0777) or die ("<p>Cannot create directory</p>"); > > } > > else { > > mkdir("/usr/local/apache/htdocs/test", 0777) or die ("<p>Cannot create directory http://192.168.10.63/TPU</p>"); > } > > 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() [<a href='function.mkdir'>function.mkdir</a>]: 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
From: "Wei, Alice J." on 14 Jul 2008 15:11 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 ajwei(a)indiana.edu ________________________________________ From: Robert Cummings [robert(a)interjinn.com] Sent: Monday, July 14, 2008 3:07 PM To: Wei, Alice J. Cc: php-general(a)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 ("<p>Cannot create directory</p>"); > chmod("/usr/local/apache/htdocs/test/$id", 0777); > mkdir("/usr/local/apache/htdocs/test/$id/contours", 0755) or die ("<p>Cannot create directory</p>"); > chmod ("/usr/local/apache/htdocs/test/$id/contours",0777); > mkdir ("/usr/local/apache/htdocs//$id/beamdata", 0777) or die ("<p>Cannot create directory</p>"); > mkdir("/usr/local/apache/htdocs//$id/schemadata", 0777) or die ("<p>Cannot create directory</p>"); > mkdir("/usr/local/apache/htdocs/$id/plandata", 0777) or die ("<p>Cannot create directory</p>"); > > } > > else { > > mkdir("/usr/local/apache/htdocs/test", 0777) or die ("<p>Cannot create directory http://192.168.10.63/TPU</p>"); > } > > 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() [<a href='function.mkdir'>function.mkdir</a>]: 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
From: Robert Cummings on 14 Jul 2008 15:21 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
From: Robert Cummings on 14 Jul 2008 15:23 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
|
Next
|
Last
Pages: 1 2 3 4 5 6 7 Prev: Math Weirdness Next: Should I go with the Singleton Pattern or wait for 5.3? |