ID: 21904 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: Apache2 related Operating System: Windows XP Professional (SP1) PHP Version: 4.3.0 New Comment:
You *must* include the 'b' flag to fopen under windows if you want to have binary safe files. $fp = fopen($fdirandname,'wb'); fwrite($fp,$pdfcode); fclose($fp); Previous Comments: ------------------------------------------------------------------------ [2003-01-27 11:15:30] [EMAIL PROTECTED] when using the fwrite with php4apache2.dll module enabled. It seems to write corrupt binary(PDF) files. I was using it with the ROS class http://www.ros.co.nz/pdf/ to write PDF files. When I changed the apache 2 server from using php4apache2.dll to just using the cgi php.exe it was able to write these files just fine with no corruption. I think something may not be working properly in the dll as it pertains to the fwrite function. I am pretty sure the error did not involve the ROS library as I was able to output to the screen with no problems with that library using the php4apache2.dll or php.exe. It was only when I tried to write it to a file with fwrite that the problem occured. This is the code I used for writing the document in case you need that. $fp = fopen($fdirandname,'w'); fwrite($fp,$pdfcode); fclose($fp); I was using Apache/2.0.43 Windows XP Professional with SP1 installed and PHP 4.3.0 (the binary install version from your website). I hope this helps. If you need any further info please email. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21904&edit=1