cannot make directory at remote host

This is a discussion on cannot make directory at remote host within the PHP General forums, part of the PHP Programming Forums category; This work localy but not on my remote host. How can I debug it? if(!(is_dir('images/$customer_id'))) { mkdir("...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-06-2007
blueboy
 
Posts: n/a
Default cannot make directory at remote host

This work localy but not on my remote host. How can I debug it?

if(!(is_dir('images/$customer_id')))
{
mkdir("images/$customer_id", 0700);

}

The file is in the main public_html folder and there is a images folder.
What should the permissions be?


Thanks
Reply With Quote
  #2 (permalink)  
Old 06-07-2007
Chris
 
Posts: n/a
Default Re: [PHP] cannot make directory at remote host

blueboy wrote:
> This work localy but not on my remote host. How can I debug it?
>
> if(!(is_dir('images/$customer_id')))
> {
> mkdir("images/$customer_id", 0700);
>
> }
>
> The file is in the main public_html folder and there is a images folder.


First tip - always use full paths instead of local ones so you know
*exactly* where it's going.

If it goes under the current folder (and I hope you have some basic
checking here somewhere for customer_id):

$customer_id = (int)$customer_id;
if ($customer_id <= 0) {
die("Bad customerid!");
}

$dir = dirname(__FILE__) . '/images/' . $customer_id;

if (!is_dir($dir)) {
mkdir($dir, 0700);
}

> What should the permissions be?


Depends on the host (whether they are running php in cgi mode or as an
apache module).

Check if safe-mode is on or off.

Check the parent folder to make sure that the webserver user has write &
execute access to be able to get into the base folder.

display errors and turn error reporting up to work out why it's not working.

--
Postgresql & php tutorials
http://www.designmagick.com/
Reply With Quote
  #3 (permalink)  
Old 06-07-2007
ross@aztechost.com
 
Posts: n/a
Default Re: [PHP] cannot make directory at remote host

Hi,

I can make the files now after setting the permission to my images folder
but I cannot delete the folder or images in it. I have tried unlink and
rmdir with no success. Even with filezilla cannot delete it


The problem seems to be the images that are set to chmod of 600 and cannot
be changed. I upload the file with this

move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $img_url)

is there a way to set the permissions of the images on upload to anything
other than 600?

R.




From: "Chris" <dmagick@gmail.com>
To: "blueboy" <ross@aztechost.com>
Cc: <php-general@lists.php.net>
Sent: Thursday, June 07, 2007 12:08 AM
Subject: Re: [php] cannot make directory at remote host


> blueboy wrote:
>> This work localy but not on my remote host. How can I debug it?
>>
>> if(!(is_dir('images/$customer_id')))
>> {
>> mkdir("images/$customer_id", 0700);
>>
>> }
>>
>> The file is in the main public_html folder and there is a images folder.

>
> First tip - always use full paths instead of local ones so you know
> *exactly* where it's going.
>
> If it goes under the current folder (and I hope you have some basic
> checking here somewhere for customer_id):
>
> $customer_id = (int)$customer_id;
> if ($customer_id <= 0) {
> die("Bad customerid!");
> }
>
> $dir = dirname(__FILE__) . '/images/' . $customer_id;
>
> if (!is_dir($dir)) {
> mkdir($dir, 0700);
> }
>
>> What should the permissions be?

>
> Depends on the host (whether they are running php in cgi mode or as an
> apache module).
>
> Check if safe-mode is on or off.
>
> Check the parent folder to make sure that the webserver user has write &
> execute access to be able to get into the base folder.
>
> display errors and turn error reporting up to work out why it's not
> working.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>

Reply With Quote
  #4 (permalink)  
Old 06-07-2007
Jim Lucas
 
Posts: n/a
Default Re: [PHP] cannot make directory at remote host

ross@aztechost.com wrote:
> Hi,
>
> I can make the files now after setting the permission to my images
> folder but I cannot delete the folder or images in it. I have tried
> unlink and rmdir with no success. Even with filezilla cannot delete it
>
>
> The problem seems to be the images that are set to chmod of 600 and
> cannot be changed. I upload the file with this
>
> move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $img_url)
>
> is there a way to set the permissions of the images on upload to
> anything other than 600?
>
> R.
>
>
>
>
> From: "Chris" <dmagick@gmail.com>
> To: "blueboy" <ross@aztechost.com>
> Cc: <php-general@lists.php.net>
> Sent: Thursday, June 07, 2007 12:08 AM
> Subject: Re: [php] cannot make directory at remote host
>
>
>> blueboy wrote:
>>> This work localy but not on my remote host. How can I debug it?
>>>
>>> if(!(is_dir('images/$customer_id')))
>>> {
>>> mkdir("images/$customer_id", 0700);
>>>
>>> }
>>>
>>> The file is in the main public_html folder and there is a images folder.

>>
>> First tip - always use full paths instead of local ones so you know
>> *exactly* where it's going.
>>
>> If it goes under the current folder (and I hope you have some basic
>> checking here somewhere for customer_id):
>>
>> $customer_id = (int)$customer_id;
>> if ($customer_id <= 0) {
>> die("Bad customerid!");
>> }
>>
>> $dir = dirname(__FILE__) . '/images/' . $customer_id;
>>
>> if (!is_dir($dir)) {
>> mkdir($dir, 0700);
>> }
>>
>>> What should the permissions be?

>>
>> Depends on the host (whether they are running php in cgi mode or as an
>> apache module).
>>
>> Check if safe-mode is on or off.
>>
>> Check the parent folder to make sure that the webserver user has write
>> & execute access to be able to get into the base folder.
>>
>> display errors and turn error reporting up to work out why it's not
>> working.
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/
>>

>

look into umask()

http://us2.php.net/umask

--
Jim Lucas

"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:37 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0