Hi,
First heres the code:
<?php
$sFileContents = "Some text blah blah";
$oFileHandle =
fopen("ftp://*****:*****@ftp.myserver.com/file.txt", "w" );
if( $oFileHandle === false )
print( "<br><b>Fopen succes</b>" );
if( fwrite( $oFileHandle, $sFileContents)===FALSE )
print( "<br><b>Writing failed!</b>" );
else
print( "<br><b>File write succesfull!</b><br>" );
fclose( $oFileHandle );
?>
Ok. Fopen is succesfull(it creates the file to server with size 0) but fwrite doesnt write anything to the file. Also fwrite doesnt give any errors..
I've tested this script with three servers. On servers with multiple vhosts it doesnt work and from our postserver(no vhosts) it is working.
Oh, and the script also works on main servers if I execute it via commandline! Do any of you guys/gals have an idea why it works in commandline but not in browser? I've checked php-settings and theres nothing wrong(and it really works in commandline so there shouldnt be..). I checked also apacheconf but nothing catched my eye in it.
Some info on the servers:
--dont work--
FreeBSD 5.2.1-RELEASE-p5 with Apache/1.3.31 and PHP 4.3.8
FreeBSD 4.8-RELEASE with Apache 1.3 and PHP 4.3.7
--Works--
FreeBSD 4.10-RELEASE-p1 with Apache/2.0.50 and PHP 4.3.8
Somehow I think its related with apache(the working one has apache 2) but it can also be that mainservers have vhosts with different options enabled/disabled..
And by the way, this is my first time ever that im seeking some advice here! 🙂