RE: [PHP] mkdir permission errors
| From: | Wei, Alice J. | Date: | Mon, 14 Jul 2008 19:11:21 +0000 |
| Subject: | RE: [PHP] mkdir permission errors | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276763@lists.php.net to get a copy of this message | ||
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@indiana.edu
________________________________________
From: Robert Cummings [robert@interjinn.com]
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 ("<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 ÁU”`S¿*ÖÉDã
> `ž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