FS#34036 - [php] Enable Large File Support in PHP

Attached to Project: Arch Linux
Opened by Ruben Van Boxem (rubenvb) - Tuesday, 26 February 2013, 19:08 GMT
Last edited by Pierre Schmitz (Pierre) - Saturday, 02 November 2013, 21:53 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Pierre Schmitz (Pierre)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
PHP produces these types of errors:
2013-02-26 19:57:26: (mod_fastcgi.c.2676) FastCGI-stderr: PHP Warning: mime_content_type(/mnt/expansion/Movies/City Of Ember (1080p+DTS).mkv): failed to open stream: Value too large for defined data type in /usr/share/webapps/owncloud/lib/helper.php on line 375

2013-02-26 19:57:26: (mod_fastcgi.c.2676) FastCGI-stderr: PHP Warning: stat(): stat failed for /mnt/expansion/Movies/City Of Ember (1080p+DTS).mkv in /usr/share/webapps/owncloud/lib/filestorage/local.php on line 33

2013-02-26 19:57:27: (mod_fastcgi.c.2676) FastCGI-stderr: PHP Notice: Undefined index: size in /usr/share/webapps/owncloud/lib/filecache.php on line 467

The file is around 10-14GB in size. A file in the same directory accessed for the same purpose (Owncloud file system scan) which is only 1.5GB, is accessed succesfully. So are a bunch of flac files of around 30MB.

Additional info:
* package version: 5.4.12-1

Steps to reproduce:
I suppose any PHP script trying to fopen() a file larger than 2GB is going to fail.

Proposed fix:
See http://ca3.php.net/manual/en/function.fopen.php#37791 and http://forums.cpanel.net/f5/compiling-php-large-file-support-69737.html
Adding CFLAGS="-D_FILE_OFFSET_BITS=64" and perhaps also "-D_LARGEFILE_SOURCE" allows PHP and thus Owncloud to access these files.
This task depends upon

Closed by  Pierre Schmitz (Pierre)
Saturday, 02 November 2013, 21:53 GMT
Reason for closing:  Upstream
Comment by Pierre Schmitz (Pierre) - Monday, 18 March 2013, 09:33 GMT
This should be fixed upstream if at all. I'd rather not add a custom compiler flag which introduces other problems and incompatibilities.
Comment by Ruben Van Boxem (rubenvb) - Monday, 18 March 2013, 09:49 GMT
Unfortunately, the bug has been there since 2004:
https://bugs.php.net/bug.php?id=27792
https://bugs.php.net/bug.php?id=45040
https://bugs.php.net/bug.php?id=48099

I cannot be sure incompatibilities will be introduced by this, as PHP is generally a mess for this kind of low-level thing.
I am aware it is a hacky fix, but it at least seems to work around basic failures like the ones I reported here.
Comment by Pierre Schmitz (Pierre) - Saturday, 02 November 2013, 21:53 GMT
Looks like x86_64 is not affected by this limitation anyway. So either compile your own PHP packages or better use a 64 bit system.

Loading...