php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20030 fopen() behaves differently in apache mod than CGI
Submitted: 2002-10-22 15:15 UTC Modified: 2002-10-25 11:59 UTC
From: remi2402 at hotmail dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 4.2.3 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: remi2402 at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-10-22 15:15 UTC] remi2402 at hotmail dot com
My script opens a remote GIF file and saves it to local hard drive. When executed with Apache 2.0.40 as CGI, everything works fine.
But when I use the apache2 module version of PHP, it only reads about 20K of the GIF.
Interestingly enough, this problem doesn't appear when opening HTML files.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-22 15:43 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip
 [2002-10-22 16:49 UTC] wez@php.net
also make sure you are using fopen($path, "rb");
the b is important under windows.
 [2002-10-23 13:27 UTC] remi2402 at hotmail dot com
fopen("file.gif", "rb") didn't change anything on my version of PHP. I'll try it with the CSV snapshot though.
 [2002-10-23 15:07 UTC] remi2402 at hotmail dot com
Nope. Snapshot wouldn't even work at all. (Module and CGI).
I get "Bad browser request" and other "internal server error".
 [2002-10-24 02:33 UTC] sniper@php.net
Did you open the write filepointer in binary mode too?

Please add your script here..but if it's very long one,
provide an URL where we can see it.


 [2002-10-25 10:22 UTC] remi2402 at hotmail dot com
I put the "b" in the other pointer and it works fine. Thanks.
It's odd that my script worked fine without it with the CGI version.
 [2002-10-25 11:59 UTC] derick@php.net
Bogussifying then
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 08:01:34 2025 UTC