NYCPHP Meetup

NYPHP.org

[nycphp-talk] mkdir failed

Phil Powell soazine at erols.com
Sat Sep 28 16:37:14 EDT 2002


AHEM.. can't use mySQL, it's not an option on my site valsignalandet.com -
sorry.. it's on a remote site and it costs much too much money for me to
use, sorry!

So, /users/ppowell/web/my has permissions set to 0755 and I cannot create
/users/ppowell/web/my/images/ I get this error upon this line:

  if (!is_dir($path)) mkdir($path, 01755);

Warning: Unable to access /users/ppowell/web/my/images/ in
/users/ppowell/web/my/process.php on line 27

The subfolder /users/ppowell/web/my/images/ does not yet exist!!!

Phil
----- Original Message -----
From: "Hans Zaunere" <zaunere at yahoo.com>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Saturday, September 28, 2002 4:20 PM
Subject: Re: [nycphp-talk] mkdir failed


>
> --- Phil Powell <soazine at erols.com> wrote:
> > Ok, I am stuck.  I am trying to create a folder in the same directory
> > as process.php and then use
> > move_uploaded_file($FILES['myImage]['tmp_name']) and it constantly
> > fails:
> >
> > mkdir() failed (Permission denied)
>
> There could be a couple reasons for this.  However, most likely, is
> that the Apache daemon doesn't have permission to write in
> /users/ppowell/web/my/images.  I'm assuming this is a shared
> environment, in which case it's rare (and good) that a daemon has write
> permissions in a user's directory.  Depending on the configuration,
> you'll need to chmod g+rwx /users/ppowell/web/my or chmod o+rwx
> /users/ppowell/web/my (hark!).  But it's probably better to make the
> directory beforehand, and then set it aside with write permissions,
> ditching the mkdir() from PHP.
>
> But be weary, because anyone using the same daemon will have write
> permissions there as well (hopefully, however, the PHP is setup with
> safe mode properly to surpress any potential issues).  I haven't been
> in a lot of shared environments so there may be a trick to this that is
> safe[r], but this is the only way around it AFAIK.  And this is why
> MySQL has become popular for storing files, ahem.
>
> Hans
>
>
>
> >
> > Here is my code:
> >
> > <?
> >   $willChangeLayout = 1; $isEmptyLayoutValues = 1;
> >
> >   foreach ($_POST as $key => $val) {
> >    if (strcmp($key, "isDefaultLayout") == 0) $willChangeLayout = 0;
> >    if (!empty($_POST[$key])) $isEmptyLayoutValues = 0;
> >    ${"$key"} = $val;
> >   }
> >
> >   // SERVER-SIDE VALIDATION
> >   if ($willChangeLayout && $isEmptyLayoutValues)
> >    header("Location: " . $refURL . "?errorMsg=" . urlencode("Please
> > fill out all required fields"));
> >
> >   // FILE UPLOAD HANDLING
> >
> >   $attempt = mkdir("/users/ppowell/web/my/images", 0655);
> >
> >   if (is_uploaded_file($_FILES['myImage']['tmp_name']))
> >    move_uploaded_file($_FILES['myImage']['tmp_name'],
> > "/users/ppowell/web/my/images/" . $_FILES['myImage']['name']);
> >
> >
> > ?>
> >
> > Please someone tell me what I'm doing wrong :(
> >
> > Thanx
> > Phil
> >
> >
> >
> >
> >
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>
>
> --- Unsubscribe at http://nyphp.org/list ---
>
>
>




More information about the talk mailing list