Re: cannot make directory at remote host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux