Does FOPEN have a maximum size limit?

Joined: 11/28/2008

Hello,

I have the following code that has been working just fine and still is, for files that are under 12Mb. But we now have a flash presentation that is 13.4 and suddenly it doesnt't work. And we have narrowed it down to be the size, because we have reduced the size to 11.6Mb and it works fine. Once we go back to full size it stops working properly. Is there a size restriction with either FOPEN or FPASSTHRU? Any ideas? Basically what I am doing is hiding the name of the file in the session variable FILE LOCATION, so the average person can't tell where I have the files stored.

Please help.

<?php
session_start
();
include (
'oconn.php');
$total = filesize($_SESSION[fileLocation]);
$fp = fopen ($_SESSION[fileLocation], "r");
header("content-type: application/x-shockwave-flash" );
header('Content-length: '.$total * 1024);
fpassthru($fp);
?>

Thanks.

Faithfulman

Joined: 11/28/2008
Crazy...

Okay, so I just went into the PHP.ini file and changed Output_buffering from "ON" to "4096". And now this functions properly. Is that weird or what?

Now I have another problem. I have two pages that do the following that are now broken. And if switch from "4096" back to "ON" then it works fine, but the flash files do not.

<?php
if ($_SERVER["HTTPS"] != "on"){
header("Location: https://$_SERVER[SERVER_NAME]/file.php");
exit;
}
?>

I need both of these functionalities to work. Does anyone have any suggestions for me?? If I try to access this script I get this error:

Warning: Cannot modify header information - headers already sent by ...

HELP!?

Thanks,

Faithful

Joined: 11/28/2008
Oy!

Apparently my fix broke many things and so I had to change it back from 4096 to "ON".

Is there a way to set this one script to outputbuffering of "4096"???

I have tried this, with no sucess:

<?php
ob_start
();
ini_set('output_buffering', '4096');

... (
rest of the script) ...
?>

It seems to respond the same way as just having the outputbuffering "ON". If I switch the server php.ini to 4096, it works fine, but it breaks other things. So, I need this one script to be "4096". Any ideas??

Thanks,

Faithful

G&G Podcast Host
Matt Farina's picture
Joined: 06/01/2006
in the htaccess file

If you check out the config page for output buffering (http://us2.php.net/manual/en/outcontrol.configurat...) you'll see that that piece of config can be done in a php.ini file or .htaccess file.

In the .htaccess/ini file you can tell it the different setting for just the one file. I would put it in the .htaccess file.

Matt Farina
Geeks and God Former Co-Host
www.mattfarina.com

Joined: 11/28/2008
Okay ... so

Okay so I am using this on a Windows 2003 Server (IIS). I don't think it has .HTACCESS capabilities. Any other suggestions for an alternative to PHP.INI ???

Thanks,

Faithful

G&G Podcast Host
Matt Farina's picture
Joined: 06/01/2006
What version of IIS?

Do you know what version of IIS?

Matt Farina
Geeks and God Former Co-Host
www.mattfarina.com

Joined: 11/28/2008
IIS6 - Windows 2003 Server

I use IIS6 - Windows 2003 Server

I have found that after I changed it to this:

output_buffering = 40960000

My site operates normally again. I'm not sure if this will cause a problem being so large though. ?? Any thoughts?

Thanks,

Faithful

G&G Podcast Host
Matt Farina's picture
Joined: 06/01/2006
FYI

Just and FYI, newer version of IIS have an XML config file that works like a .htaccess file.

This setting just sets a max size for the output buffer. If you have something larger than this size it will fail. If you set it really large you should never hit the max.

Matt Farina
Geeks and God Former Co-Host
www.mattfarina.com