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

Re: php4-ftp / ftp.so



On Mon, 2006-03-06 at 10:53 +0100, Mark Lijftogt wrote:
> Hi Hans,
> 
> I looks like that you have change the directory structure during the 
> migration. A plain
> "no such file or directory" notice says enough.
> 
> Make sure that /home/www/web3/web/ is realy there, and with a little 
> luck the mkdir
> error will vanish in to thin air aswell.
> 
>  ,Mark

Thanks, Mark, after I installed everything that starts with php4- ftp is
now enabled (better cover my behind for future problems).  I realised
that ftp chroots the user to their home directory, so the path is wrong.
I'm still getting one error:

Warning: ftp_close() expects parameter 1 to be resource, null given
in /home/www/web3/web/testftp.php on line 33

I am not a php programmer, so I'm not sure if this is a code problem or
a problem on my (administrator) side.  I'll include the code for
reference sake.

Thanks
Hans

<?
phpinfo();
$server='localhost'; // ftp server
$connection = ftp_connect($server); // connection

// login to ftp server
$user = "xxxxxxx";
$pass = "xxxxxxx";
$result = ftp_login($connection, $user, $pass);

ftp_pasv ($connection, 1);

// $gallery_path = '/home/www/web3/web/';
$gallery_path = '/web/';

$path = $gallery_path;
$newDir = 'mynewdirectory';

// check if connection was made
if ((!$connection) || (!$result)) {
        return false;
        exit();
}
else {
        ftp_chdir($connection, $path); // go to destination dir
        if(ftp_mkdir($connection,$newDir)) { // create directory
                $chmod_cmd="CHMOD 0777 ".$newDir;
                $chmod=ftp_site($connection, $chmod_cmd);
                echo $newDir;
        } else {
                return false;
        }
        ftp_close($conn_id); // close connection
}
?>





Reply to: