0

I'm using Win 7, 64 bit, and an XAMPP installation (ApacheFriends XAMPP Version 5.6.3).

I tried the function given at http://php.net/manual/en/function.fseek.php#112647

But that didn't work. It only ever reads up to byte PHP_INT_MAX which is 2147483647. I tried seeks around that number, so I'm pretty sure that's the boundary.

Someone said it depends which datatype php uses internally. Where to find information about the datatype used in my php installation?

Is this the answer in the readme.txt if the xampp installation directory: It says " + PHP 5.6.3 (VC11 X86 32bit thread safe) + PEAR"?

Greetings John

John
  • 605
  • 9
  • 28
  • Install a x64 version of php, since you're using a 64bit system? On a 32bit system `PHP_MAX_INT` is `2147483647`, while on a 64bit system it's `9223372036854775807` – Cyclonecode Mar 10 '15 at 02:01
  • http://stackoverflow.com/questions/864058/how-to-have-64-bit-integer-on-php – Cyclonecode Mar 10 '15 at 02:10
  • @Cyclone: That's not the answer. I made a new post, because there is a bug or faulty optimization in the php-code. – John Mar 10 '15 at 14:22

2 Answers2

1

It's not possible to seek over (PHP_MAX_INT + 8192) with a 32bit php build.
(It should be possible to use a 64bit php build, but I haven't tried that.)

Once seeking to the maximum possible position, one could still fread from on there, but it's not possible to seek further.

Trying workarounds (that were even upvoted on php.net-manual) with multiple seeks didn't work on my system. Instead they put the filepointer to different positions at under PHP_MAX_INT.

John
  • 605
  • 9
  • 28
1

The 64 bit version of PHP 7 works, it appears stable, and it is not "experimental" like the 5.6 builds. This is your best bet if you have the ability to upgrade. It will take a bit of work to deal with some non-backward compatible changes, like error handling.

As a side note, you will get unexpected (broken) scripts if you try to deal with nearly anything greater than 2GB on a 32 bit build. Even setting any php.ini variables like memory_limit greater than 2GB could have unexpected results.

Frank Forte
  • 2,031
  • 20
  • 19