PHP 4.0 Bug #9806 Updated: fwrite doesn't work on Windows 2000 with Apache Server.

From: Date: Sat, 17 Mar 2001 19:55:03 +0000
Subject: PHP 4.0 Bug #9806 Updated: fwrite doesn't work on Windows 2000 with Apache Server.
Groups: php.dev 
Request: Send a blank email to php-dev+get-49246@lists.php.net to get a copy of this message
ID: 9806 User Update by: leonardo@pcnet.ro Status: Closed Bug Type: Filesystem function related Description: fwrite doesn't work on Windows 2000 with Apache Server. Now that's ok! Thank you. You're great. Previous Comments: --------------------------------------------------------------------------- [2001-03-17 14:31:02] sniper@php.net Note: I just added a note into the docs for fwrite() functions about this. --Jani --------------------------------------------------------------------------- [2001-03-17 14:26:20] sniper@php.net RTFM: http://www.php.net/fopen ie. Just add the 'b': fopen("http://www.some_site.com/some_picture.jpg", "rb" fopen("http://www.some_site.com/some_picture.jpg", "wb" --Jani --------------------------------------------------------------------------- [2001-03-17 13:35:52] leonardo@pcnet.ro Thank you Jani! This is the code: if($fd_url = fopen("http://www.some_site.com/some_picture.jpg", "r")) { $fd_img = fopen("c:\some_picture.jpg", "w"); while (!feof($fd_url)) { $buffer = fread($fd_url, 4096); fwrite($fd_img, $buffer, strlen(buffer)); } fclose($fd_img); fclose($fd_url); } --------------------------------------------------------------------------- [2001-03-17 13:20:17] sniper@php.net What was the fopen() line you have used? --Jani --------------------------------------------------------------------------- [2001-03-17 06:51:05] leonardo@pcnet.ro I have two web servers with Windows 2000 running on them. One of them uses as a web server Microsoft IIS and the other one Apache 1.3.19 for Windows. I have a php script which connects to a remote web server and grabs an image. The image is written on a file (with fwrite function) and saved on the local harddisk. If I run the php script on IIS the image is saved correctly. If I run the php script on Apache the image is corrupted (has a larger length in bytes; usually, between 1-50 bytes). --------------------------------------------------------------------------- The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online. Full Bug description available at: http://bugs.php.net/?id=9806

« previous php.dev (#49246) next »