Bug #14095 Updated: fopen/fwrite does not create file via "ftp://"
| From: | mfischer@php.net | Date: | Sat, 17 Nov 2001 22:32:32 +0000 |
| Subject: | Bug #14095 Updated: fopen/fwrite does not create file via "ftp://" | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-70759@lists.php.net to get a copy of this message | ||
ID: 14095
Updated by: mfischer
Reported By: jason@audiorapture.com
Old Status: Open
Status: Feedback
Bug Type: FTP related
Operating System: Windows NT4 SP6a
PHP Version: 4.0.6
New Comment:
Can you please test with a more recent version (e.g. from php4win.de) ?
Previous Comments:
------------------------------------------------------------------------
[2001-11-17 17:16:35] jason@audiorapture.com
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 this bug report at http://bugs.php.net/?id=14095&edit=1