Re: [PHP] Achieving 64-bit integers on 32-bit platforms

2005-06-30 Thread Dan Goodes
On Thu, 30 Jun 2005 at 00:16, Richard Lynch wrote:

 On Wed, June 29, 2005 9:02 pm, Dan Goodes said:
  This 32-bit limitation is haunting me everywhere I turn.
 
  Is it possible with PHP (at compile-time if need be) to make it use large
  (64-bit) integers?

 I believe that PHP runs fine on 64-bit hardware, and uses 64-bit ints
 everywhere on that...

 So, in theory at least, just buying a 64-bit machine would solve your
 problem...

 Not that you necessarily *can* run out and buy a 64-bit machine, mind you.

yes. especially since each of our front-end webservers would need to be
64-bit to do what i was hoping to do. what I was hoping for was a way to
make php use 64-bit integers (or fake it somehow), such as apache2.0.54
does for files of that size.

  I'm asking because I would like to perform operations on large files, and
 
  fillesize($filename)
 
  is returning an error, even when I use
 
  sprintf(%u, filesize($file))
 
  as per the manual for filesize(). I get:
 
  Warning: filesize(): Stat failed for FC4-i386-DVD.iso (errno=75 - Value
  too large for defined data type)
 
  Any thoughts/ideas/suggestions? Thanks!

 At least for THIS particular function, you could use exec(du $filename,
 ...) and then you'd have a string representation of the size, which you
 could then display or even manipulate with BC_MATH or that other
 new-fangled arbitrary precision mathematics PHP Module whose name I
 forget.

 This is a much less general solution, but may suffice for now.

well, it may suffice actually. I'm just not sure of the performance impact
of doing this for every file from all our front-end boxes anytime someone
does a directory listing.

thanks for the answers :-)

--dan

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



[PHP] Achieving 64-bit integers on 32-bit platforms

2005-06-29 Thread Dan Goodes
Hi Folks

This 32-bit limitation is haunting me everywhere I turn.

Is it possible with PHP (at compile-time if need be) to make it use large
(64-bit) integers?

I'm asking because I would like to perform operations on large files, and

fillesize($filename)

is returning an error, even when I use

sprintf(%u, filesize($file))

as per the manual for filesize(). I get:

Warning: filesize(): Stat failed for FC4-i386-DVD.iso (errno=75 - Value too 
large for defined data type)

Any thoughts/ideas/suggestions? Thanks!

Regards,

Dan Goodes  :  Systems Programmer  :  [EMAIL PROTECTED]

Help support PlanetMirror - Australia's largest Internet archive
by signing up for PlanetMirror Premium : http://planetmirror.com

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



Re: [PHP] Interesting question re HTTP Ranges and PHP

2003-07-17 Thread Dan Goodes
Hi Chris, a million thanks for the help there. That's what i thought I'd 
have to do.

What I'm doing now is inspect the Range header to pull out the start and 
end, and then deduce the length, and then using fopen, fseek and fread to 
open the file and read from a certain offset for a certain length.

Now I have another dilemma. It's all well and good to use fread() to read 
into a variable, and then echo that (or just echo(fread()) ..) but suppose 
someone requests from 100-65000 bytes of an ISO file - that's gonna 
pretty quickly drag the machine down.

Basically what i'm looking for is something similar to readfile() but with 
offset and length support. Any ideas ?? I suspect the answer lies in 
streams, but i could be wrong.

-Dan

On Wed, 16 Jul 2003, Chris Shiflett wrote:

 --- Dan Goodes [EMAIL PROTECTED] wrote:
  What I want is for the PHP script to read ALL the headers for the
  request (in particular, RANGE headers), and then return the relevant
  portion of the file. Can this be done fairly simply?
 
 I think you will find all header in the $_SERVER array. It is definitely
 possible to do what you're wanting, but I'm not sure exactly how simple you
 will think it is. Maybe there is some existing code someone has written that
 does this sort of thing for you, but I'm not aware of any.
 
 At most, you would just have to parse the Range header yourself to deduce what
 byte range to serve.
 
  Also is there a way for PHP to tell apache which response code to
  send?
 
 Yeah, this should work:
 
 header('HTTP/1.1 206 Partial Content');
 
 Hope that helps.
 
 Chris
 
 =
 Become a better Web developer with the HTTP Developer's Handbook
 http://httphandbook.org/
 

-- 
Regards,

Dan Goodes  :  Systems Programmer  :  [EMAIL PROTECTED]

Help support PlanetMirror - Australia's largest Internet archive
by signing up for PlanetMirror Premium : http://planetmirror.com


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



[PHP] Interesting question re HTTP Ranges and PHP

2003-07-16 Thread Dan Goodes
Hi folks,

I currently have an interesting dilemma - any help is appreciated (if 
possible, CC directly to [EMAIL PROTECTED] as well as the list).

What Ive got is a PHP wrapper script that performs authetication, and uses 
readfile() to return the requested file. So a user requests 
/path/to/file, PHP interveins and performs authentication, then does a 
realfile on /REAL/path/to/file to return the file.

What I want is for the PHP script to read ALL the headers for the request 
(in particular, RANGE headers), and then return the relevant portion of 
the file. Can this be done fairly simply? Obviously there has to be 
additional headers returned to the client by the script when it's 
returning a RANGE response. Also is there a way for PHP to tell apache 
which response code to send? i.e. in my testing even tho I send a resume 
code with wget, apache's response is 200 OK, not 206 Partial Content...

Any help/advice is appreciated...

-Dan


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



Re: [PHP] parse error

2003-01-02 Thread Dan Goodes
Or, another option is to use single-quotes in the HTML:

   echo(table border='0' width='125' height='27');

That way you can include variables in there if you see fit (since the
string itself is still double-quoted), and you don't have to worry about
escpaing the double-quotes.

-Dan

On Thu, 2 Jan 2003, Michael J. Pawlowsky wrote:

 You need to esape your quotes in the HTML
 as in
 
   echo(table border=0 width=125 height=27);
 
 should be
 
   echo(table border=\0\ width=\125\ height=\27\);
 
 
 Mike
 
 
 
 
 *** REPLY SEPARATOR  ***
 
 On 02/01/2003 at 11:27 PM Ezequiel Sapoznik wrote:
 
 Hi!
 I am receiving a parse error in the following code. The file is located at
 http://www.historiadelpais.com.ar/ppal_bio.php
 
 Anyone can help me?
 
 Thanks!
 
 Ezequiel
 
 html
 
 head
 titleBiografias/title
 /head
 body background=images/StyleGreenMarble_Bg.jpg
 ?php
   $db = mysql_connect(localhost, user, password);
   mysql_select_db(efemerides,$db);
   $response = mysql_query(select * from biografias where indice=1, $db);
   while($row = mysql_fetch_array($response));
 
 
   echo(p align=centerimg border=0 src=images/banner_chico_bio.jpg
 width=274 height=43/p);
   print img src=\  . $row[banner_nombre] . \;
   echo(div align=center);
   echo(center);
   echo(table border=1 width=500 height=25);
   echo(tr);
   echo(td width=500 height=25);
   echo(div align=left);
   echo(table border=0 width=125 height=27);
   echo(tr);
   echo(td width=125 height=27/td);
   echo(/tr);
   echo(/table);
   echo(/div);
   echo(p);
 
print($row[texto] .br\n);
 
   echo(/td);
   echo(/tr);
   echo(/table);
   echo(/center);
   echo(/div);
   }
 
 ?
 
 
 /div
 
 /html
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 

-- 
Regards,

Dan Goodes
PlanetMirror Admin

http://planetmirror.com/
[EMAIL PROTECTED]


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