|
Posted by Markus on 03/19/07 12:54
Hello
Is it possible to determine the PHP path to the FTP base directory?
ftp_pwd($conn_id) returns '/', while I need something like
'/data/users/domain.com/'.
I used a construct such as:
$list = ftp_nlist($conn_id, ftp_pwd($conn_id));
foreach ($list as $entry) {
if (stristr($_SERVER['DOCUMENT_ROOT'], '/'.$entry)) {
$split = explode($entry, $_SERVER['DOCUMENT_ROOT']);
$ftp_basedir = $split[0];
break;
}
That works well in most cases; anyway now I have a case where
$_SERVER['DOCUMENT_ROOT'] has a duplicate folder name, such as
'/data/htdocs/domain.com/htdocs/', which makes the above process fail. I
think of complicated things like have FTP write a file into the base
directory, and let PHP search for it, but I hope there is an easier method!
Thanks for a comment
Markus
Navigation:
[Reply to this message]
|