Re: [PHP] [? BUG ?] weird thing;downloading from a php script stops at exactly 2.000.000 bytes

2005-06-11 Thread Catalin Trifu
Hi,

There is not a big speed difference between the two.
The only thing is that it was frustrating to find out the limitations
on readfile.
I used it before with large files and it was ok; only to find out now
that on 5.0.4 it doesn't work as it used to.
As php manual states readfile should be the way to spit a file out
the wire.
btw:
$fp = fopen('somefile');
fpassthru($fp);
is also stopping at 2.000.000 bytes, which definetely drives me
to think there is a bug somewhere.


Catalin


Richard Lynch wrote:
> On Thu, June 9, 2005 4:12 pm, Catalin Trifu said:
> 
>>  Tried it and it works indeed, but it's quite annoying to make such
>>tricks
>>and is not the best solution either; fopen and fread are "expensive".
>>   I can't say if it's a bug in PHP or some config option.
> 
> 
> You may want to benchmark the difference between readfile and fopen/fread
> for a 1.9M file.
> 
> If it ain't much, don't worry about it.
> 
> One posible work-around:
> 
> `cat filename`;
> 
> This MIGHT be cheaper than fopen/fread -- Or not, since it has to build a
> shell of some kind, I think.
> 
> PS File a bug report, if you haven't already.
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-10 Thread Richard Lynch
On Thu, June 9, 2005 4:12 pm, Catalin Trifu said:
>   Tried it and it works indeed, but it's quite annoying to make such
> tricks
> and is not the best solution either; fopen and fread are "expensive".
>I can't say if it's a bug in PHP or some config option.

You may want to benchmark the difference between readfile and fopen/fread
for a 1.9M file.

If it ain't much, don't worry about it.

One posible work-around:

`cat filename`;

This MIGHT be cheaper than fopen/fread -- Or not, since it has to build a
shell of some kind, I think.

PS File a bug report, if you haven't already.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-10 Thread Rasmus Lerdorf
Uh, never mind.  I guess I should read the thread.  You are downloading,
not uploading.  I can't think of anything that would put an exact limit
on the download like that.

-Rasmus

Rasmus Lerdorf wrote:
> Didn't really follow this thread, but it sounds to me like you have
> 
>upload_max_filesize = 2M
> 
> which also happens to be the default uploaded filesize limit.
> 
> -Rasmus
> 
> Catalin Trifu wrote:
> 
>>  Hi,
>>
>>   It can't be a memory limit problem. The server ha 2GB memory,
>>and in PHP each script can consume up to 64MB. On php4, apache 1.3 and
>>same configs readfile works without fread tricks.
>>
>>C.
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-10 Thread Rasmus Lerdorf
Didn't really follow this thread, but it sounds to me like you have

   upload_max_filesize = 2M

which also happens to be the default uploaded filesize limit.

-Rasmus

Catalin Trifu wrote:
>   Hi,
> 
>It can't be a memory limit problem. The server ha 2GB memory,
> and in PHP each script can consume up to 64MB. On php4, apache 1.3 and
> same configs readfile works without fread tricks.
> 
> C.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-10 Thread Rory Browne
Check  out the readfile manual page. Someone made a user-contributed
comment about that.

As it happens they came up with pretty much the same solution as I did.

On 6/10/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> Hi,
> 
>It can't be a memory limit problem. The server ha 2GB memory,
> and in PHP each script can consume up to 64MB. On php4, apache 1.3 and
> same configs readfile works without fread tricks.
> 
> C.
> 
> 
> Rory Browne wrote:
> > It's probably something to do with maximum memory, or something like
> > that, but taking into account that your method is stretching the
> > resources, fopen/fread may be a better solution.
> >
> > I'd be curious to see the benchmarked differences  - but couldn't be
> > bothered at this minute doing the benchmarking atm.
> >
> > On 6/10/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> >
> >>   Hi,
> >>
> >>  Tried it and it works indeed, but it's quite annoying to make such tricks
> >>and is not the best solution either; fopen and fread are "expensive".
> >>   I can't say if it's a bug in PHP or some config option.
> >>
> >>
> >>C.
> >>
> >>
> >>Rory Browne wrote:
> >>
> >>>I've never came across that problem, but try this
> >>>
> >>>function output_file($filename){
> >>>$fp = fopen($filename, "r");
> >>>while(!feof($fp)){
> >>>  echo fread($fp, 1024000);
> >>>}
> >>>}
> >>>
> >>>On 6/9/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> Hi,
> 
>   I installed php5 using the configue below. I tried with apache2 as well 
>  and same things.
> 
> './configure' '--prefix=/usr/local/php5' 
> '--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
> '--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' 
> '--enable-sockets' '--enable-exif'
> '--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
> '--enable-gd-native-ttf'
> '--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
> '--with-mysql=/usr'
> '--with-xsl' '--with-libxml-dir=/usr'
> 
>   I have a script which generates a temporary catalog file, which is 
>  generated correctly having
> 4.7MB on disk.
>   Then I push up the wire with readfile($filname):
> 
>   header("Content-Type: text/csv");
>   header("Content-Disposition: attachment; filename=somfilename.csv");
>   header("Content-Length: ". filesize($file));
> 
>   readfile($file);
> 
>   I also tried with fopen.
>   If I try to download the file directly from apache it works, all 4.7MB 
>  are received.
> 
>   As expected the browser starts the download and reports it is expecting 
>  a file of 4.7MB.
>   However, the download stops at 2.000.000 bytes no matter what browser I 
>  use (normally i use
> Firefox on Linux), no matter if php runs on apache2 or apache1.3
> 
>   Is there some php config option I missed ?
>   Could this be from curlwrappers ?
>   Where could this come from ?
> 
> 
> Thanks,
> Catalin
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-10 Thread Catalin Trifu
Hi,

   It can't be a memory limit problem. The server ha 2GB memory,
and in PHP each script can consume up to 64MB. On php4, apache 1.3 and
same configs readfile works without fread tricks.

C.


Rory Browne wrote:
> It's probably something to do with maximum memory, or something like
> that, but taking into account that your method is stretching the
> resources, fopen/fread may be a better solution.
> 
> I'd be curious to see the benchmarked differences  - but couldn't be
> bothered at this minute doing the benchmarking atm.
> 
> On 6/10/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> 
>>   Hi,
>>
>>  Tried it and it works indeed, but it's quite annoying to make such tricks
>>and is not the best solution either; fopen and fread are "expensive".
>>   I can't say if it's a bug in PHP or some config option.
>>
>>
>>C.
>>
>>
>>Rory Browne wrote:
>>
>>>I've never came across that problem, but try this
>>>
>>>function output_file($filename){
>>>$fp = fopen($filename, "r");
>>>while(!feof($fp)){
>>>  echo fread($fp, 1024000);
>>>}
>>>}
>>>
>>>On 6/9/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
>>>
>>>
Hi,

  I installed php5 using the configue below. I tried with apache2 as well 
 and same things.

'./configure' '--prefix=/usr/local/php5' 
'--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
'--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' 
'--enable-sockets' '--enable-exif'
'--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
'--enable-gd-native-ttf'
'--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
'--with-mysql=/usr'
'--with-xsl' '--with-libxml-dir=/usr'

  I have a script which generates a temporary catalog file, which is 
 generated correctly having
4.7MB on disk.
  Then I push up the wire with readfile($filname):

  header("Content-Type: text/csv");
  header("Content-Disposition: attachment; filename=somfilename.csv");
  header("Content-Length: ". filesize($file));

  readfile($file);

  I also tried with fopen.
  If I try to download the file directly from apache it works, all 4.7MB 
 are received.

  As expected the browser starts the download and reports it is expecting a 
 file of 4.7MB.
  However, the download stops at 2.000.000 bytes no matter what browser I 
 use (normally i use
Firefox on Linux), no matter if php runs on apache2 or apache1.3

  Is there some php config option I missed ?
  Could this be from curlwrappers ?
  Where could this come from ?


Thanks,
Catalin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-09 Thread Rory Browne
It's probably something to do with maximum memory, or something like
that, but taking into account that your method is stretching the
resources, fopen/fread may be a better solution.

I'd be curious to see the benchmarked differences  - but couldn't be
bothered at this minute doing the benchmarking atm.

On 6/10/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
>Hi,
> 
>   Tried it and it works indeed, but it's quite annoying to make such tricks
> and is not the best solution either; fopen and fread are "expensive".
>I can't say if it's a bug in PHP or some config option.
> 
> 
> C.
> 
> 
> Rory Browne wrote:
> > I've never came across that problem, but try this
> >
> > function output_file($filename){
> > $fp = fopen($filename, "r");
> > while(!feof($fp)){
> >   echo fread($fp, 1024000);
> > }
> > }
> >
> > On 6/9/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> >
> >>Hi,
> >>
> >>   I installed php5 using the configue below. I tried with apache2 as well 
> >> and same things.
> >>
> >>'./configure' '--prefix=/usr/local/php5' 
> >>'--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
> >>'--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' 
> >>'--enable-sockets' '--enable-exif'
> >>'--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
> >>'--enable-gd-native-ttf'
> >>'--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
> >>'--with-mysql=/usr'
> >>'--with-xsl' '--with-libxml-dir=/usr'
> >>
> >>   I have a script which generates a temporary catalog file, which is 
> >> generated correctly having
> >>4.7MB on disk.
> >>   Then I push up the wire with readfile($filname):
> >>
> >>   header("Content-Type: text/csv");
> >>   header("Content-Disposition: attachment; filename=somfilename.csv");
> >>   header("Content-Length: ". filesize($file));
> >>
> >>   readfile($file);
> >>
> >>   I also tried with fopen.
> >>   If I try to download the file directly from apache it works, all 4.7MB 
> >> are received.
> >>
> >>   As expected the browser starts the download and reports it is expecting 
> >> a file of 4.7MB.
> >>   However, the download stops at 2.000.000 bytes no matter what browser I 
> >> use (normally i use
> >>Firefox on Linux), no matter if php runs on apache2 or apache1.3
> >>
> >>   Is there some php config option I missed ?
> >>   Could this be from curlwrappers ?
> >>   Where could this come from ?
> >>
> >>
> >>Thanks,
> >>Catalin
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-09 Thread Catalin Trifu
   Hi,

  Tried it and it works indeed, but it's quite annoying to make such tricks
and is not the best solution either; fopen and fread are "expensive".
   I can't say if it's a bug in PHP or some config option.


C.


Rory Browne wrote:
> I've never came across that problem, but try this
> 
> function output_file($filename){
> $fp = fopen($filename, "r");
> while(!feof($fp)){
>   echo fread($fp, 1024000);
> }
> }
> 
> On 6/9/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> 
>>Hi,
>>
>>   I installed php5 using the configue below. I tried with apache2 as well 
>> and same things.
>>
>>'./configure' '--prefix=/usr/local/php5' 
>>'--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
>>'--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' 
>>'--enable-sockets' '--enable-exif'
>>'--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
>>'--enable-gd-native-ttf'
>>'--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
>>'--with-mysql=/usr'
>>'--with-xsl' '--with-libxml-dir=/usr'
>>
>>   I have a script which generates a temporary catalog file, which is 
>> generated correctly having
>>4.7MB on disk.
>>   Then I push up the wire with readfile($filname):
>>
>>   header("Content-Type: text/csv");
>>   header("Content-Disposition: attachment; filename=somfilename.csv");
>>   header("Content-Length: ". filesize($file));
>>
>>   readfile($file);
>>
>>   I also tried with fopen.
>>   If I try to download the file directly from apache it works, all 4.7MB are 
>> received.
>>
>>   As expected the browser starts the download and reports it is expecting a 
>> file of 4.7MB.
>>   However, the download stops at 2.000.000 bytes no matter what browser I 
>> use (normally i use
>>Firefox on Linux), no matter if php runs on apache2 or apache1.3
>>
>>   Is there some php config option I missed ?
>>   Could this be from curlwrappers ?
>>   Where could this come from ?
>>
>>
>>Thanks,
>>Catalin
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-09 Thread Rory Browne
I've never came across that problem, but try this

function output_file($filename){
$fp = fopen($filename, "r");
while(!feof($fp)){
  echo fread($fp, 1024000);
}
}

On 6/9/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> Hi,
> 
>I installed php5 using the configue below. I tried with apache2 as well 
> and same things.
> 
> './configure' '--prefix=/usr/local/php5' 
> '--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
> '--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' 
> '--enable-sockets' '--enable-exif'
> '--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
> '--enable-gd-native-ttf'
> '--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
> '--with-mysql=/usr'
> '--with-xsl' '--with-libxml-dir=/usr'
> 
>I have a script which generates a temporary catalog file, which is 
> generated correctly having
> 4.7MB on disk.
>Then I push up the wire with readfile($filname):
> 
>header("Content-Type: text/csv");
>header("Content-Disposition: attachment; filename=somfilename.csv");
>header("Content-Length: ". filesize($file));
> 
>readfile($file);
> 
>I also tried with fopen.
>If I try to download the file directly from apache it works, all 4.7MB are 
> received.
> 
>As expected the browser starts the download and reports it is expecting a 
> file of 4.7MB.
>However, the download stops at 2.000.000 bytes no matter what browser I 
> use (normally i use
> Firefox on Linux), no matter if php runs on apache2 or apache1.3
> 
>Is there some php config option I missed ?
>Could this be from curlwrappers ?
>Where could this come from ?
> 
> 
> Thanks,
> Catalin
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-09 Thread Catalin Trifu
Hi,

   I installed php5 using the configue below. I tried with apache2 as well and 
same things.

'./configure' '--prefix=/usr/local/php5' 
'--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
'--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' '--enable-sockets' 
'--enable-exif'
'--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
'--enable-gd-native-ttf'
'--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
'--with-mysql=/usr'
'--with-xsl' '--with-libxml-dir=/usr'

   I have a script which generates a temporary catalog file, which is generated 
correctly having
4.7MB on disk.
   Then I push up the wire with readfile($filname):

   header("Content-Type: text/csv");
   header("Content-Disposition: attachment; filename=somfilename.csv");
   header("Content-Length: ". filesize($file));

   readfile($file);

   I also tried with fopen.
   If I try to download the file directly from apache it works, all 4.7MB are 
received.

   As expected the browser starts the download and reports it is expecting a 
file of 4.7MB.
   However, the download stops at 2.000.000 bytes no matter what browser I use 
(normally i use
Firefox on Linux), no matter if php runs on apache2 or apache1.3

   Is there some php config option I missed ?
   Could this be from curlwrappers ?
   Where could this come from ?


Thanks,
Catalin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php