473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

getting file size for really big (10GB) files?

Hi all.
I am developing a filemanager that needs to handle big files. While
testing on some zipped files of 6-7GB each I noticed that filesize(),
filemtime() and similar php-functions can't handle fikles larger than
2GB. This is true on the two servers I have regular access to (one
php4-RedHat, the other php5-Fedora).

If there a way to ger around these functions somehow? My fallback plan
is to use the systems functions and then parse the output-text to get
at the needed data. Naturally I was looking for a prettier way to do
it.

I'd appreciate any tips on the subject. thanks.

Jul 1 '06 #1
6 7705
In article <11**********************@m79g2000cwm.googlegroups .com>,
ma****@eimermusic.com says...
Hi all.
I am developing a filemanager that needs to handle big files. While
testing on some zipped files of 6-7GB each I noticed that filesize(),
filemtime() and similar php-functions can't handle fikles larger than
2GB. This is true on the two servers I have regular access to (one
php4-RedHat, the other php5-Fedora).

If there a way to ger around these functions somehow? My fallback plan
is to use the systems functions and then parse the output-text to get
at the needed data. Naturally I was looking for a prettier way to do
it.

I'd appreciate any tips on the subject. thanks.


I must be honest - I would choose another language if I wanted to do that
(10 Gb is quite a small file in my world)

PHP takes the absurd step of converting any integer it doesnt like into
a float on the fly at runtime - a more dangerous practice I can't
imagine. The upshot is maybe you'll come unstuck trying to manipulate
large integers.

Obviously you can work around preventing that from being a problem but
you shouldn't have to.

I dont know if its relevant to your situation but I thought I'd just
highlight it because it caused me big problems.

tony
Jul 1 '06 #2
My suggestion is you shell out and execute 'ls' and send output to a
txt file and then parse the result if you just need the file size.

Martin wrote:
Hi all.
I am developing a filemanager that needs to handle big files. While
testing on some zipped files of 6-7GB each I noticed that filesize(),
filemtime() and similar php-functions can't handle fikles larger than
2GB. This is true on the two servers I have regular access to (one
php4-RedHat, the other php5-Fedora).

If there a way to ger around these functions somehow? My fallback plan
is to use the systems functions and then parse the output-text to get
at the needed data. Naturally I was looking for a prettier way to do
it.

I'd appreciate any tips on the subject. thanks.
Jul 2 '06 #3

Thanks for both your replys.

I have noticed that PHP does not handle big files well in any
situation. The manual brushes by this and, for example, suggests I use
sprinf to make an unsigned number to get the correct size for files up
to 4GB. So very 90s. :)

I am surprised that PHP can't simply get the same result as 'ls'. I was
thinking of using it but the downside is that it imposes some
limitations on the server installation I can use. Ideally I would like
to avoid exec() and other commands that is often blocked on hosting
servers. (even though most won't like 10Gb files anyway)

The bigger problem is really that different installations return vastly
different results for filesize(). My local php4 (Mac OS X) at least
returns a number while the php5 (Fedora) server I use throws a warning
and returns false on the same file. Php5 on Fedora I really expected to
be up to it.

Sorry for the little rant. This is one area where I assumed PHP would
be OK. Developing an application for a few months and at the final
testing stage finding out these problems is no fun. You can imagine how
much headscratching I have done to get the uploading and downloading of
these huge files to work... and then I stumble on this "detail".

Thanks again guys.

Jul 2 '06 #4
Well, if it makes you feel better (and worse after reading) here isthe
bug report. Its supposed to be fixed, but no one has done anything in a
few years. I am surprised. I guess people jut use Java for issues like
this.

http://bugs.php.net/bug.php?id=27792

Martin wrote:
Thanks for both your replys.

I have noticed that PHP does not handle big files well in any
situation. The manual brushes by this and, for example, suggests I use
sprinf to make an unsigned number to get the correct size for files up
to 4GB. So very 90s. :)

I am surprised that PHP can't simply get the same result as 'ls'. I was
thinking of using it but the downside is that it imposes some
limitations on the server installation I can use. Ideally I would like
to avoid exec() and other commands that is often blocked on hosting
servers. (even though most won't like 10Gb files anyway)

The bigger problem is really that different installations return vastly
different results for filesize(). My local php4 (Mac OS X) at least
returns a number while the php5 (Fedora) server I use throws a warning
and returns false on the same file. Php5 on Fedora I really expected to
be up to it.

Sorry for the little rant. This is one area where I assumed PHP would
be OK. Developing an application for a few months and at the final
testing stage finding out these problems is no fun. You can imagine how
much headscratching I have done to get the uploading and downloading of
these huge files to work... and then I stumble on this "detail".

Thanks again guys.
Jul 3 '06 #5
In article <11*********************@a14g2000cwb.googlegroups. com>,
j_********@yahoo.com says...
Well, if it makes you feel better (and worse after reading) here isthe
bug report. Its supposed to be fixed, but no one has done anything in a
few years. I am surprised. I guess people jut use Java for issues like
this.

http://bugs.php.net/bug.php?id=27792

I cant imagine why anyone would use java for anything at all.
Jul 6 '06 #6
Ok, Java is an overkill. But if you have to overcome a bug then maybe
use Ruby or Python or Perl.

mi***@fan.com wrote:
In article <11*********************@a14g2000cwb.googlegroups. com>,
j_********@yahoo.com says...
Well, if it makes you feel better (and worse after reading) here isthe
bug report. Its supposed to be fixed, but no one has done anything in a
few years. I am surprised. I guess people jut use Java for issues like
this.

http://bugs.php.net/bug.php?id=27792
I cant imagine why anyone would use java for anything at all.
Jul 6 '06 #7

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

Similar topics

1
by: Bob Smith | last post by:
Are these the same: 1. f_size = os.path.getsize(file_name) 2. fp1 = file(file_name, 'r') data = fp1.readlines() last_byte = fp1.tell() I always get the same value when doing 1. or 2. Is...
16
by: kate | last post by:
salve. per favore rispondete alla mia domanda: Come faccio a ottenere le dimensioni di un file?(con c/c++) risp presto grazie
3
by: Roshawn Dawson | last post by:
Hi, Does anyone know how to get the size of an xml file using VB.NET? I haven't the slightest idea where to begin. Thanks, Roshawn
17
by: Arnold | last post by:
Is using fseek and ftell a reliable method of getting the file size on a binary file? I thought I remember reading somewhere it wasn't... If not what would be the "right" and portable method to...
4
by: supster | last post by:
I have the full file path of a file stored as a string and I'de like to get the file size in bytes. What is the most efficient way of doing this with a static method from the File class or...
1
by: Mark | last post by:
How can I get size of file on http resource? For example I want to get the total size of the file which is located on http://mysite.com/myfile.zip.
9
by: Manu | last post by:
Hi, Following code shows how a packet is sent from a client to a server's socket. The file size (fileSizeTemp) is converted to network byte order before sending to the server. *((unsigned...
2
by: alagariya | last post by:
SQL log file size on 22/06/2007 shown as 10GB...now its showing as 20GB....but when taking backup...the backup file size is 4MB only......when restoring, it showing msg that there is no space, due to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.