Re: mkdir permission errors

From: Date: Mon, 14 Jul 2008 19:07:47 +0000
Subject: Re: mkdir permission errors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-276760@lists.php.net to get a copy of this message
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

« previous php.general (#276760) next »