|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-11-17 17:32 UTC] mfischer@php.net
[2001-11-17 17:52 UTC] jason at audiorapture dot com
[2002-01-02 09:44 UTC] mfischer@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 11:00:01 2025 UTC |
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);