0

I have a file with size of 2.67 GB (2870348740 bytes).

I want to add some data between 2296278993 - 2583313866 bytes.

I'm in Windows Server 2003 32-bit and for this reason int positive range is very low and I can't seek in large files.

Sample code:

$fp = fopen('test.mp4','r+b');
fseek($fp,2296278993);
echo ftell($fp); // returns 0 !!

ftell() returns 0 because 2296278993 is larger than range of int on the x86 platform. What else can I do?

Will
  • 24,082
  • 14
  • 97
  • 108
saeid ezzati
  • 855
  • 11
  • 29
  • See a possible answer here: https://stackoverflow.com/questions/5501451/php-x86-how-to-get-filesize-of-2gb-file-without-external-program . You're running into the limitations of 32 bit integers. – Will Dec 29 '15 at 14:29
  • @Will that solutions is only for detecting size of large files !! – saeid ezzati Dec 29 '15 at 14:44
  • Possible XY problem detected. Windows Server 2003 was EOL'd in July of this year (source: [Windows lifecycle](https://support.microsoft.com/en-us/lifecycle/search/default.aspx?alpha=Windows%20Server%202003%20R2)). This means newly discovered security vulnerabilities in the operating system will never be fixed. Is there a reason you cannot switch to a supported 64-bit OS? – Damian Yerrick Dec 29 '15 at 14:52
  • our server admin dont change os and I must make program only on it – saeid ezzati Dec 29 '15 at 14:58

0 Answers0