From:             [EMAIL PROTECTED]
Operating system: Windows NT4 SP6a
PHP version:      4.0.6
PHP Bug Type:     FTP related
Bug description:  fopen/fwrite does not create file via "ftp://";

PHP as CGI on NT4SP6a/IIS4.

To update a file on the server, I read the old contents into an array,
populate a string with modified content, delete the old file, and use
fopen/fwrite to write a new one.
This worked great on FreeBSD/Apache, now on NT4/IIS4 the new file is not
written.

There are *no* error messages, but the file is not there.

Really messed up is the fact that the file is written successfully when I
specify the previous FreeBSD/Apache host in $FTPSite...

The following variables are defined before the code below runs:
$newcontents
$FTPUser
$FTPPass (contains special characters, e.g. "urb@n")
$FTPSite ("host.domain.tl")
$FTPDoc  ("/path/filename")

[Curiously, I cannot use "localhost" or an IP address as
$FTPSite...("unable to find ftpbuf 0" on ftp_login and ftp_delete as well
as "php_hostconnect: connect failed" on fopen)]

// delete previous file via ftp
$ftp = ftp_connect($FTPSite);
ftp_login($ftp, $FTPUser, $FTPPass);
ftp_delete($ftp, $FTPDoc);
ftp_quit($ftp);

// get file handler
$FTPOpen="ftp://"; . rawurlencode($FTPUser) . ":" . rawurlencode($FTPPass) .
"@" . $FTPSite . $FTPDoc;
//echo $FTPOpen . "<BR>";
$NewTopTen = fopen($FTPOpen,"w");
echo $NewTopTen;
// write new content to file
fwrite($NewTopTen, $newcontents);

//close file handle
fclose($NewTopTen);

-- 
Edit bug report at: http://bugs.php.net/?id=14095&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to