You are here: Re: [PHP] Achieving 64-bit integers on 32-bit platforms « PHP « IT news, forums, messages
Re: [PHP] Achieving 64-bit integers on 32-bit platforms

Posted by "Richard Lynch" on 07/01/05 04:41

On Thu, June 30, 2005 4:02 pm, Dan Goodes said:
> 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?

>> 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 :-)

You could *MAYBE* get a performance gain out of caching fullpath,
filemtime, and filesize in a database, if every page is already opening a
database connection anyway...

I'm not sure a file stat is slower than a query or not. Actually, nobody
is sure. Depends on your hardware.

Obviously you need an index on the file path, and that can limit the path
length more than the OS limits it, but this may or may not matter, and you
may or may not have all these files rooted in some known directory you can
leave off to ameliorate the limit...

I guess you could even md5 hash the full path, and take the basename() and
store both. Odds on those both matching up and causing a collision are
astronmical, I think.

Another option would be to catch the error, and only use exec("du") when
you absolutely had to, for the files over 2 Gig.

Or even (gasp!) just tell the user "over 2 Gig" any time the error
occurred. :-)

Cuz, really, once a file is over 2 Gig, does anybody using a web interface
to look at it really care?...

Maybe for your application they would, because the are using the web
interface to "do things".

But maybe most people would be like "Okay, that's monster big, I ain't
downloading THAT sucker!" for everything over 2 Gig anyway.

Depends why you are doing this, but it's a POSSIBLE answer if it's a
linked system to let folks download stuff.

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация