473,608 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Large File Not Being Sent To Client

My company produces reports for our customers in PDF format. I have a
php script that verifies login status and access rights, and sends
the pdf to the client using readfile().

This has worked fine until recently. One of our customers' reports
is 10.6MB, and the customer never receives it and I can't get it
either. I checked the Apache access_log, and it shows varying
amounts of bytes being sent, but always close to 10MB.

I tried changing the php script to do fopen(), fread(), echo,
ob_flush() and flush(). After each flush, I write a message to a log
file. The messages in the log file stop at 10MB, as if the php script
is hung.

Using a network monitor, I see the connection being established, the
HTTP GET being sent, but no content coming back.

PHP version is 5.1.2
Apache is 2.2.3
OS is SuSE Linux Enterprise Server 10.0 - 64bit

Current test version looks like this:

ini_set("output _buffering", "0");
ini_set("implic it_flush", "1");
ini_set("memory _limit", "100M");
ini_set("max_ex ecution_time", "600");
$lth = 0;
$in = fopen($path, "r");
while (!feof($in)) {
$data = fread($in, 8192);
$lth += strlen($data);
$errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
echo $data;
$errLog->WriteLog("Afte r echo" , "debug.txt" );
ob_flush();
$errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
flush();
$errLog->WriteLog("Afte r flush" , "debug.txt" );
}
$errLog->WriteLog("Go t EOF", "debug.txt" );
fclose($in);
$errLog->WriteLog("En d of Script - read $lth bytes", "debug.txt" );
The last five lines of the debug.txt log file say:

Read 10223616 bytes
After echo
After ob_flush
After flush
Read 10231808 bytes
After echo

So it's never returning from the ob_flush() call. Time from first
log entry to last is about 1 second.

Any ideas?
John
Mar 9 '07 #1
9 1535
On 2007-03-09 10:28, John C. Frickson wrote:
My company produces reports for our customers in PDF format. I have a
php script that verifies login status and access rights, and sends
the pdf to the client using readfile().

This has worked fine until recently. One of our customers' reports
is 10.6MB, and the customer never receives it and I can't get it
either. I checked the Apache access_log, and it shows varying
amounts of bytes being sent, but always close to 10MB.

I tried changing the php script to do fopen(), fread(), echo,
ob_flush() and flush(). After each flush, I write a message to a log
file. The messages in the log file stop at 10MB, as if the php script
is hung.

Using a network monitor, I see the connection being established, the
HTTP GET being sent, but no content coming back.

PHP version is 5.1.2
Apache is 2.2.3
OS is SuSE Linux Enterprise Server 10.0 - 64bit

Current test version looks like this:

ini_set("output _buffering", "0");
ini_set("implic it_flush", "1");
ini_set("memory _limit", "100M");
ini_set("max_ex ecution_time", "600");
$lth = 0;
$in = fopen($path, "r");
while (!feof($in)) {
$data = fread($in, 8192);
$lth += strlen($data);
$errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
echo $data;
$errLog->WriteLog("Afte r echo" , "debug.txt" );
ob_flush();
$errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
flush();
$errLog->WriteLog("Afte r flush" , "debug.txt" );
}
$errLog->WriteLog("Go t EOF", "debug.txt" );
fclose($in);
$errLog->WriteLog("En d of Script - read $lth bytes", "debug.txt" );
The last five lines of the debug.txt log file say:

Read 10223616 bytes
After echo
After ob_flush
After flush
Read 10231808 bytes
After echo

So it's never returning from the ob_flush() call. Time from first
log entry to last is about 1 second.

Any ideas?
John
I noticed I didn't have a "Content-Length" header, so I added it
and it's now working. Even without the header, it should have
worked anyway, shouldn't it?
Mar 9 '07 #2
John C. Frickson wrote:
On 2007-03-09 10:28, John C. Frickson wrote:
>My company produces reports for our customers in PDF format. I have a
php script that verifies login status and access rights, and sends
the pdf to the client using readfile().

This has worked fine until recently. One of our customers' reports
is 10.6MB, and the customer never receives it and I can't get it
either. I checked the Apache access_log, and it shows varying
amounts of bytes being sent, but always close to 10MB.

I tried changing the php script to do fopen(), fread(), echo,
ob_flush() and flush(). After each flush, I write a message to a log
file. The messages in the log file stop at 10MB, as if the php script
is hung.

Using a network monitor, I see the connection being established, the
HTTP GET being sent, but no content coming back.

PHP version is 5.1.2
Apache is 2.2.3
OS is SuSE Linux Enterprise Server 10.0 - 64bit

Current test version looks like this:

ini_set("output _buffering", "0");
ini_set("implic it_flush", "1");
ini_set("memory _limit", "100M");
ini_set("max_ex ecution_time", "600");
$lth = 0;
$in = fopen($path, "r");
while (!feof($in)) {
$data = fread($in, 8192);
$lth += strlen($data);
$errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
echo $data;
$errLog->WriteLog("Afte r echo" , "debug.txt" );
ob_flush();
$errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
flush();
$errLog->WriteLog("Afte r flush" , "debug.txt" );
}
$errLog->WriteLog("Go t EOF", "debug.txt" );
fclose($in);
$errLog->WriteLog("En d of Script - read $lth bytes", "debug.txt" );
The last five lines of the debug.txt log file say:

Read 10223616 bytes
After echo
After ob_flush
After flush
Read 10231808 bytes
After echo

So it's never returning from the ob_flush() call. Time from first
log entry to last is about 1 second.

Any ideas?
John

I noticed I didn't have a "Content-Length" header, so I added it
and it's now working. Even without the header, it should have
worked anyway, shouldn't it?
Not reliably. There is a reason for the Content-Length header - to let
the browser know how much to expect.

Without the header the browser is free to figure on it's own how long
the data should be (no browser I know of allows "unlimited length). And
evidently you finally exceeded the browser default.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 10 '07 #3


On 2007-03-09 20:41, Jerry Stuckle wrote:
John C. Frickson wrote:
>On 2007-03-09 10:28, John C. Frickson wrote:
>>My company produces reports for our customers in PDF format. I have a
php script that verifies login status and access rights, and sends
the pdf to the client using readfile().

This has worked fine until recently. One of our customers' reports
is 10.6MB, and the customer never receives it and I can't get it
either. I checked the Apache access_log, and it shows varying
amounts of bytes being sent, but always close to 10MB.

I tried changing the php script to do fopen(), fread(), echo,
ob_flush() and flush(). After each flush, I write a message to a log
file. The messages in the log file stop at 10MB, as if the php script
is hung.

Using a network monitor, I see the connection being established, the
HTTP GET being sent, but no content coming back.

PHP version is 5.1.2
Apache is 2.2.3
OS is SuSE Linux Enterprise Server 10.0 - 64bit

Current test version looks like this:

ini_set("output _buffering", "0");
ini_set("implic it_flush", "1");
ini_set("memory _limit", "100M");
ini_set("max_ex ecution_time", "600");
$lth = 0;
$in = fopen($path, "r");
while (!feof($in)) {
$data = fread($in, 8192);
$lth += strlen($data);
$errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
echo $data;
$errLog->WriteLog("Afte r echo" , "debug.txt" );
ob_flush();
$errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
flush();
$errLog->WriteLog("Afte r flush" , "debug.txt" );
}
$errLog->WriteLog("Go t EOF", "debug.txt" );
fclose($in);
$errLog->WriteLog("En d of Script - read $lth bytes", "debug.txt" );
The last five lines of the debug.txt log file say:

Read 10223616 bytes
After echo
After ob_flush
After flush
Read 10231808 bytes
After echo

So it's never returning from the ob_flush() call. Time from first
log entry to last is about 1 second.

Any ideas?
John

I noticed I didn't have a "Content-Length" header, so I added it
and it's now working. Even without the header, it should have
worked anyway, shouldn't it?

Not reliably. There is a reason for the Content-Length header - to let
the browser know how much to expect.

Without the header the browser is free to figure on it's own how long
the data should be (no browser I know of allows "unlimited length). And
evidently you finally exceeded the browser default.
Except NO data ever got sent to the browser. So it's something in
either PHP or Apache that decided to quit. True, I wrote bad code
by forgetting the Content-Length header, but it's a bit disturbing
that PHP or Apache just didn't send any data without any kind of
warning or error message.
Mar 11 '07 #4
John C. Frickson wrote:
>

On 2007-03-09 20:41, Jerry Stuckle wrote:
>John C. Frickson wrote:
>>On 2007-03-09 10:28, John C. Frickson wrote:
My company produces reports for our customers in PDF format. I have a
php script that verifies login status and access rights, and sends
the pdf to the client using readfile().

This has worked fine until recently. One of our customers' reports
is 10.6MB, and the customer never receives it and I can't get it
either. I checked the Apache access_log, and it shows varying
amounts of bytes being sent, but always close to 10MB.

I tried changing the php script to do fopen(), fread(), echo,
ob_flush() and flush(). After each flush, I write a message to a log
file. The messages in the log file stop at 10MB, as if the php script
is hung.

Using a network monitor, I see the connection being established, the
HTTP GET being sent, but no content coming back.

PHP version is 5.1.2
Apache is 2.2.3
OS is SuSE Linux Enterprise Server 10.0 - 64bit

Current test version looks like this:

ini_set("output _buffering", "0");
ini_set("implic it_flush", "1");
ini_set("memory _limit", "100M");
ini_set("max_ex ecution_time", "600");
$lth = 0;
$in = fopen($path, "r");
while (!feof($in)) {
$data = fread($in, 8192);
$lth += strlen($data);
$errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
echo $data;
$errLog->WriteLog("Afte r echo" , "debug.txt" );
ob_flush();
$errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
flush();
$errLog->WriteLog("Afte r flush" , "debug.txt" );
}
$errLog->WriteLog("Go t EOF", "debug.txt" );
fclose($in);
$errLog->WriteLog("En d of Script - read $lth bytes", "debug.txt" );
The last five lines of the debug.txt log file say:

Read 10223616 bytes
After echo
After ob_flush
After flush
Read 10231808 bytes
After echo

So it's never returning from the ob_flush() call. Time from first
log entry to last is about 1 second.

Any ideas?
John

I noticed I didn't have a "Content-Length" header, so I added it
and it's now working. Even without the header, it should have
worked anyway, shouldn't it?

Not reliably. There is a reason for the Content-Length header - to
let the browser know how much to expect.

Without the header the browser is free to figure on it's own how long
the data should be (no browser I know of allows "unlimited length).
And evidently you finally exceeded the browser default.

Except NO data ever got sent to the browser. So it's something in
either PHP or Apache that decided to quit. True, I wrote bad code
by forgetting the Content-Length header, but it's a bit disturbing
that PHP or Apache just didn't send any data without any kind of
warning or error message.
What's in your Apache error log?

Or, if you are logging PHP errors to a separate log file (unusual, but
possible - check phpinfo()), what's in it?

And if there is such a severe error that PHP/Apache can't send your data
to the browser, it probably can't send an error message, either. But it
will log something.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 11 '07 #5


On 2007-03-11 07:48, Jerry Stuckle wrote:
John C. Frickson wrote:
>>

On 2007-03-09 20:41, Jerry Stuckle wrote:
>>John C. Frickson wrote:
On 2007-03-09 10:28, John C. Frickson wrote:
My company produces reports for our customers in PDF format. I have a
php script that verifies login status and access rights, and sends
the pdf to the client using readfile().
>
This has worked fine until recently. One of our customers' reports
is 10.6MB, and the customer never receives it and I can't get it
either. I checked the Apache access_log, and it shows varying
amounts of bytes being sent, but always close to 10MB.
>
I tried changing the php script to do fopen(), fread(), echo,
ob_flush( ) and flush(). After each flush, I write a message to a log
file. The messages in the log file stop at 10MB, as if the php script
is hung.
>
Using a network monitor, I see the connection being established, the
HTTP GET being sent, but no content coming back.
>
PHP version is 5.1.2
Apache is 2.2.3
OS is SuSE Linux Enterprise Server 10.0 - 64bit
>
Current test version looks like this:
>
ini_set("output _buffering", "0");
ini_set("implic it_flush", "1");
ini_set("memory _limit", "100M");
ini_set("max_ex ecution_time", "600");
$lth = 0;
$in = fopen($path, "r");
while (!feof($in)) {
$data = fread($in, 8192);
$lth += strlen($data);
$errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
echo $data;
$errLog->WriteLog("Afte r echo" , "debug.txt" );
ob_flush();
$errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
flush();
$errLog->WriteLog("Afte r flush" , "debug.txt" );
}
$errLog->WriteLog("Go t EOF", "debug.txt" );
fclose($in);
$errLog->WriteLog("En d of Script - read $lth bytes", "debug.txt" );
>
>
The last five lines of the debug.txt log file say:
>
Read 10223616 bytes
After echo
After ob_flush
After flush
Read 10231808 bytes
After echo
>
So it's never returning from the ob_flush() call. Time from first
log entry to last is about 1 second.
>
Any ideas?
John

I noticed I didn't have a "Content-Length" header, so I added it
and it's now working. Even without the header, it should have
worked anyway, shouldn't it?

Not reliably. There is a reason for the Content-Length header - to
let the browser know how much to expect.

Without the header the browser is free to figure on it's own how long
the data should be (no browser I know of allows "unlimited length).
And evidently you finally exceeded the browser default.

Except NO data ever got sent to the browser. So it's something in
either PHP or Apache that decided to quit. True, I wrote bad code
by forgetting the Content-Length header, but it's a bit disturbing
that PHP or Apache just didn't send any data without any kind of
warning or error message.

What's in your Apache error log?

Or, if you are logging PHP errors to a separate log file (unusual, but
possible - check phpinfo()), what's in it?

And if there is such a severe error that PHP/Apache can't send your data
to the browser, it probably can't send an error message, either. But it
will log something.
Nothing in the Apache error log (where PHP errors usually go).
The Apache access log shows a "200" response code and a short
number of bytes (such as 10343101 when it should be 11500016).

I'm cross-posting this to a couple other groups that might be
relevant.
Mar 11 '07 #6
John C. Frickson wrote:
>

On 2007-03-11 07:48, Jerry Stuckle wrote:
>John C. Frickson wrote:
>>>

On 2007-03-09 20:41, Jerry Stuckle wrote:
John C. Frickson wrote:
On 2007-03-09 10:28, John C. Frickson wrote:
>My company produces reports for our customers in PDF format. I have a
>php script that verifies login status and access rights, and sends
>the pdf to the client using readfile().
>>
>This has worked fine until recently. One of our customers' reports
>is 10.6MB, and the customer never receives it and I can't get it
>either. I checked the Apache access_log, and it shows varying
>amounts of bytes being sent, but always close to 10MB.
>>
>I tried changing the php script to do fopen(), fread(), echo,
>ob_flush () and flush(). After each flush, I write a message to a log
>file. The messages in the log file stop at 10MB, as if the php script
>is hung.
>>
>Using a network monitor, I see the connection being established, the
>HTTP GET being sent, but no content coming back.
>>
>PHP version is 5.1.2
>Apache is 2.2.3
>OS is SuSE Linux Enterprise Server 10.0 - 64bit
>>
>Current test version looks like this:
>>
> ini_set("output _buffering", "0");
> ini_set("implic it_flush", "1");
> ini_set("memory _limit", "100M");
> ini_set("max_ex ecution_time", "600");
> $lth = 0;
> $in = fopen($path, "r");
> while (!feof($in)) {
> $data = fread($in, 8192);
> $lth += strlen($data);
> $errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
> echo $data;
> $errLog->WriteLog("Afte r echo" , "debug.txt" );
> ob_flush();
> $errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
> flush();
> $errLog->WriteLog("Afte r flush" , "debug.txt" );
> }
> $errLog->WriteLog("Go t EOF", "debug.txt" );
> fclose($in);
> $errLog->WriteLog("En d of Script - read $lth bytes", "debug.txt" );
>>
>>
>The last five lines of the debug.txt log file say:
>>
> Read 10223616 bytes
> After echo
> After ob_flush
> After flush
> Read 10231808 bytes
> After echo
>>
>So it's never returning from the ob_flush() call. Time from first
>log entry to last is about 1 second.
>>
>Any ideas?
>John
>
I noticed I didn't have a "Content-Length" header, so I added it
and it's now working. Even without the header, it should have
worked anyway, shouldn't it?

Not reliably. There is a reason for the Content-Length header - to
let the browser know how much to expect.

Without the header the browser is free to figure on it's own how
long the data should be (no browser I know of allows "unlimited
length). And evidently you finally exceeded the browser default.
Except NO data ever got sent to the browser. So it's something in
either PHP or Apache that decided to quit. True, I wrote bad code
by forgetting the Content-Length header, but it's a bit disturbing
that PHP or Apache just didn't send any data without any kind of
warning or error message.

What's in your Apache error log?

Or, if you are logging PHP errors to a separate log file (unusual, but
possible - check phpinfo()), what's in it?

And if there is such a severe error that PHP/Apache can't send your
data to the browser, it probably can't send an error message, either.
But it will log something.

Nothing in the Apache error log (where PHP errors usually go).
The Apache access log shows a "200" response code and a short
number of bytes (such as 10343101 when it should be 11500016).

I'm cross-posting this to a couple other groups that might be
relevant.
In that case data WAS sent to the browser. But since it was incomplete
it looks like the browser just didn't display anything.

That's not unusual.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 11 '07 #7
On 11 Mar, 18:11, "John C. Frickson" <frickson_AT_gi bbon.comwrote:
On 2007-03-11 07:48, Jerry Stuckle wrote:
John C. Frickson wrote:
On 2007-03-09 20:41, Jerry Stuckle wrote:
John C. Frickson wrote:
On 2007-03-09 10:28, John C. Frickson wrote:
My company produces reports for our customers in PDF format. I have a
php script that verifies login status and access rights, and sends
the pdf to the client using readfile().
>>>This has worked fine until recently. One of our customers' reports
is 10.6MB, and the customer never receives it and I can't get it
either. I checked the Apache access_log, and it shows varying
amounts of bytes being sent, but always close to 10MB.
>>>I tried changing the php script to do fopen(), fread(), echo,
ob_flush() and flush(). After each flush, I write a message to a log
file. The messages in the log file stop at 10MB, as if the php script
is hung.
>>>Using a network monitor, I see the connection being established, the
HTTP GET being sent, but no content coming back.
>>>PHP version is 5.1.2
Apache is 2.2.3
OS is SuSE Linux Enterprise Server 10.0 - 64bit
>>>Current test version looks like this:
>>> ini_set("output _buffering", "0");
ini_set("implic it_flush", "1");
ini_set("memory _limit", "100M");
ini_set("max_ex ecution_time", "600");
$lth = 0;
$in = fopen($path, "r");
while (!feof($in)) {
$data = fread($in, 8192);
$lth += strlen($data);
$errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
echo $data;
$errLog->WriteLog("Afte r echo" , "debug.txt" );
ob_flush();
$errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
flush();
$errLog->WriteLog("Afte r flush" , "debug.txt" );
}
$errLog->WriteLog("Go t EOF", "debug.txt" );
fclose($in);
$errLog->WriteLog("En d of Script - read $lth bytes", "debug.txt" );
>>>The last five lines of the debug.txt log file say:
>>> Read 10223616 bytes
After echo
After ob_flush
After flush
Read 10231808 bytes
After echo
>>>So it's never returning from the ob_flush() call. Time from first
log entry to last is about 1 second.
>>>Any ideas?
John
>>I noticed I didn't have a "Content-Length" header, so I added it
and it's now working. Even without the header, it should have
worked anyway, shouldn't it?
>Not reliably. There is a reason for the Content-Length header - to
let the browser know how much to expect.
>Without the header the browser is free to figure on it's own how long
the data should be (no browser I know of allows "unlimited length).
And evidently you finally exceeded the browser default.
Except NO data ever got sent to the browser. So it's something in
either PHP or Apache that decided to quit. True, I wrote bad code
by forgetting the Content-Length header, but it's a bit disturbing
that PHP or Apache just didn't send any data without any kind of
warning or error message.
What's in your Apache error log?
Or, if you are logging PHP errors to a separate log file (unusual, but
possible - check phpinfo()), what's in it?
And if there is such a severe error that PHP/Apache can't send your data
to the browser, it probably can't send an error message, either. But it
will log something.

Nothing in the Apache error log (where PHP errors usually go).
The Apache access log shows a "200" response code and a short
number of bytes (such as 10343101 when it should be 11500016).

I'm cross-posting this to a couple other groups that might be
relevant.
resume.
If in doubt put a static PDF served only by apache (not through
script), and then GET that, stop it half way through and then refresh,
watch the headers for status 206 and info about number of bytes offset/
number of bytes content length.

Mar 12 '07 #8


On 2007-03-11 13:34, Jerry Stuckle wrote:
John C. Frickson wrote:
>>

On 2007-03-11 07:48, Jerry Stuckle wrote:
>>John C. Frickson wrote:
On 2007-03-09 20:41, Jerry Stuckle wrote:
John C. Frickson wrote:
>On 2007-03-09 10:28, John C. Frickson wrote:
>>My company produces reports for our customers in PDF format. I have a
>>php script that verifies login status and access rights, and sends
>>the pdf to the client using readfile().
>>>
>>This has worked fine until recently. One of our customers' reports
>>is 10.6MB, and the customer never receives it and I can't get it
>>either. I checked the Apache access_log, and it shows varying
>>amounts of bytes being sent, but always close to 10MB.
>>>
>>I tried changing the php script to do fopen(), fread(), echo,
>>ob_flush( ) and flush(). After each flush, I write a message to a log
>>file. The messages in the log file stop at 10MB, as if the php script
>>is hung.
>>>
>>Using a network monitor, I see the connection being established, the
>>HTTP GET being sent, but no content coming back.
>>>
>>PHP version is 5.1.2
>>Apache is 2.2.3
>>OS is SuSE Linux Enterprise Server 10.0 - 64bit
>>>
>>Current test version looks like this:
>>>
>> ini_set("output _buffering", "0");
>> ini_set("implic it_flush", "1");
>> ini_set("memory _limit", "100M");
>> ini_set("max_ex ecution_time", "600");
>> $lth = 0;
>> $in = fopen($path, "r");
>> while (!feof($in)) {
>> $data = fread($in, 8192);
>> $lth += strlen($data);
>> $errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
>> echo $data;
>> $errLog->WriteLog("Afte r echo" , "debug.txt" );
>> ob_flush();
>> $errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
>> flush();
>> $errLog->WriteLog("Afte r flush" , "debug.txt" );
>> }
>> $errLog->WriteLog("Go t EOF", "debug.txt" );
>> fclose($in);
>> $errLog->WriteLog("En d of Script - read $lth bytes", "debug.txt" );
>>>
>>>
>>The last five lines of the debug.txt log file say:
>>>
>> Read 10223616 bytes
>> After echo
>> After ob_flush
>> After flush
>> Read 10231808 bytes
>> After echo
>>>
>>So it's never returning from the ob_flush() call. Time from first
>>log entry to last is about 1 second.
>>>
>>Any ideas?
>>John
>>
>I noticed I didn't have a "Content-Length" header, so I added it
>and it's now working. Even without the header, it should have
>worked anyway, shouldn't it?
>
Not reliably. There is a reason for the Content-Length header - to
let the browser know how much to expect.
>
Without the header the browser is free to figure on it's own how
long the data should be (no browser I know of allows "unlimited
length). And evidently you finally exceeded the browser default.
>

Except NO data ever got sent to the browser. So it's something in
either PHP or Apache that decided to quit. True, I wrote bad code
by forgetting the Content-Length header, but it's a bit disturbing
that PHP or Apache just didn't send any data without any kind of
warning or error message.

What's in your Apache error log?

Or, if you are logging PHP errors to a separate log file (unusual, but
possible - check phpinfo()), what's in it?

And if there is such a severe error that PHP/Apache can't send your
data to the browser, it probably can't send an error message, either.
But it will log something.

Nothing in the Apache error log (where PHP errors usually go).
The Apache access log shows a "200" response code and a short
number of bytes (such as 10343101 when it should be 11500016).

I'm cross-posting this to a couple other groups that might be
relevant.

In that case data WAS sent to the browser. But since it was incomplete
it looks like the browser just didn't display anything.

That's not unusual.
In my original message I wrote "Using a network monitor, I see
the connection being established, the HTTP GET being sent, but
no content coming back." The browser did NOT receive ANY data.
Mar 12 '07 #9
John C. Frickson wrote:
>

On 2007-03-11 13:34, Jerry Stuckle wrote:
>John C. Frickson wrote:
>>>

On 2007-03-11 07:48, Jerry Stuckle wrote:
John C. Frickson wrote:
>
>
On 2007-03-09 20:41, Jerry Stuckle wrote:
>John C. Frickson wrote:
>>On 2007-03-09 10:28, John C. Frickson wrote:
>>>My company produces reports for our customers in PDF format. I
>>>have a
>>>php script that verifies login status and access rights, and sends
>>>the pdf to the client using readfile().
>>>>
>>>This has worked fine until recently. One of our customers' reports
>>>is 10.6MB, and the customer never receives it and I can't get it
>>>either . I checked the Apache access_log, and it shows varying
>>>amount s of bytes being sent, but always close to 10MB.
>>>>
>>>I tried changing the php script to do fopen(), fread(), echo,
>>>ob_flush () and flush(). After each flush, I write a message to a
>>>log
>>>file. The messages in the log file stop at 10MB, as if the php
>>>script
>>>is hung.
>>>>
>>>Using a network monitor, I see the connection being established,
>>>the
>>>HTTP GET being sent, but no content coming back.
>>>>
>>>PHP version is 5.1.2
>>>Apache is 2.2.3
>>>OS is SuSE Linux Enterprise Server 10.0 - 64bit
>>>>
>>>Curren t test version looks like this:
>>>>
>>> ini_set("output _buffering", "0");
>>> ini_set("implic it_flush", "1");
>>> ini_set("memory _limit", "100M");
>>> ini_set("max_ex ecution_time", "600");
>>> $lth = 0;
>>> $in = fopen($path, "r");
>>> while (!feof($in)) {
>>> $data = fread($in, 8192);
>>> $lth += strlen($data);
>>> $errLog->WriteLog("Re ad $lth bytes" , "debug.txt" );
>>> echo $data;
>>> $errLog->WriteLog("Afte r echo" , "debug.txt" );
>>> ob_flush();
>>> $errLog->WriteLog("Afte r ob_flush" , "debug.txt" );
>>> flush();
>>> $errLog->WriteLog("Afte r flush" , "debug.txt" );
>>> }
>>> $errLog->WriteLog("Go t EOF", "debug.txt" );
>>> fclose($in);
>>> $errLog->WriteLog("En d of Script - read $lth bytes",
>>>"debug.t xt");
>>>>
>>>>
>>>The last five lines of the debug.txt log file say:
>>>>
>>> Read 10223616 bytes
>>> After echo
>>> After ob_flush
>>> After flush
>>> Read 10231808 bytes
>>> After echo
>>>>
>>>So it's never returning from the ob_flush() call. Time from first
>>>log entry to last is about 1 second.
>>>>
>>>Any ideas?
>>>John
>>>
>>I noticed I didn't have a "Content-Length" header, so I added it
>>and it's now working. Even without the header, it should have
>>worked anyway, shouldn't it?
>>
>Not reliably. There is a reason for the Content-Length header -
>to let the browser know how much to expect.
>>
>Without the header the browser is free to figure on it's own how
>long the data should be (no browser I know of allows "unlimited
>length). And evidently you finally exceeded the browser default.
>>
>
Except NO data ever got sent to the browser. So it's something in
either PHP or Apache that decided to quit. True, I wrote bad code
by forgetting the Content-Length header, but it's a bit disturbing
that PHP or Apache just didn't send any data without any kind of
warning or error message.

What's in your Apache error log?

Or, if you are logging PHP errors to a separate log file (unusual,
but possible - check phpinfo()), what's in it?

And if there is such a severe error that PHP/Apache can't send your
data to the browser, it probably can't send an error message,
either. But it will log something.
Nothing in the Apache error log (where PHP errors usually go).
The Apache access log shows a "200" response code and a short
number of bytes (such as 10343101 when it should be 11500016).

I'm cross-posting this to a couple other groups that might be
relevant.

In that case data WAS sent to the browser. But since it was
incomplete it looks like the browser just didn't display anything.

That's not unusual.

In my original message I wrote "Using a network monitor, I see
the connection being established, the HTTP GET being sent, but
no content coming back." The browser did NOT receive ANY data.
And your Apache log says around 10M was sent. What happened to it?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 12 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
913
by: zhimin | last post by:
Hi, I'm writing a program to send large file(100m) through dotnet using TCPListener & TCPClient, I'm sending the file with a ask and response loop: 1. Client send a flag 1 to server indicate it has data send to server. 2. Client send the buffer block size. 3. Client send the actual buffer to the server. 4. Server send a flag 1 to client indicating that the buffer has been successfully receeived. 5. The next loop until all data of the...
4
8053
by: zhimin | last post by:
Hi, I'm writing a program to send large file(100m) through dotnet using TCPListener & TCPClient, I'm sending the file with a ask and response loop: 1. Client send a flag 1 to server indicate it has data send to server. 2. Client send the buffer block size. 3. Client send the actual buffer to the server. 4. Server send a flag 1 to client indicating that the buffer has been successfully receeived. 5. The next loop until all data of the...
11
308
by: Ron Vecchi | last post by:
I've used System.Web.Mail before but have never had the need to send attchemnets through it...until now. A client of mine would like a form on the website to allow a user to type up a message and upload a file. I'm staying away from mailto links. So the file and message will be uploaded to the server when the user clicks send. The new file and message will be processed and emailed from the server to my client. I'm tring to get any...
3
6325
by: Buddy Ackerman | last post by:
I'm trying to write files directly to the client so that it forces the client to open the Save As dialog box rather than display the file. On some occasions the files are very large (100MB+). On these files teh time that it takes until the client displays the Save As dialog can be extrordinarily long (3+ minutes). I don't understand why. I was initiall using the format: Respnse.writefile("filepath", offset, length) but that simply...
7
9877
by: iporter | last post by:
I use the code below to authorise the download of certain files. Thus, instead of linking to the file in a wwwroot directory, I link to this code with the filename as a parameter, and the script streams the file if the user is authorised. This has worked fine on PDFs, DOCs, XLS, etc. until today, and 18MB file presents the error message 'format error: not a pdf or corrupt'. Is there a file size limit, or a default that needs...
0
8003
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8498
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8478
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8152
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8341
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5476
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1598
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.