#21904 [Opn->Fbk]: fwrite writes corrupt pdf binary file
| From: | wez@php.net | Date: | Mon, 27 Jan 2003 18:17:25 +0000 |
| Subject: | #21904 [Opn->Fbk]: fwrite writes corrupt pdf binary file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-31349@lists.php.net to get a copy of this message | ||
ID: 21904
Updated by: wez@php.net
Reported By: delay@pobox.com
-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] delay@pobox.com
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