FTP Plugin and big files
- Status
- Closed
- Subject
- FTP Plugin and big files
- Version
- 6.x
- Category
- Error
- Patch
- Feature
- Wiki Plugin (extends basic syntax)
- Resolution status
- Partially solved
- Submitted by
- yajo
- Lastmod by
- Ushindi Gedeon
- Rating
- Description
Using the FTP Plugin
, when you try to download a big file you'll encounter an error like this:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 59506688 bytes) in /home/myUser/public_html/lib/wiki-plugins/wikiplugin_ftp.php on line 65
In this case, I had tried to download a 56 MB file with a PHP memory_limit set to 128 MB on my hosting.
- Solution
Using readfile instead of file_get_contents. Here's the patch:
fix FTP plugin with big filesCopy to clipboardIndex: lib/wiki-plugins/wikiplugin_ftp.php =================================================================== --- lib/wiki-plugins/wikiplugin_ftp.php (revisione 30989) +++ lib/wiki-plugins/wikiplugin_ftp.php (copia locale) @@ -61,16 +61,15 @@ ftp_close($conn_id); return tra('failed'); } - ftp_close($conn_id); - $content = file_get_contents($local); + ftp_close($conn_id); $type = filetype($local); - unlink($local); header ("Content-type: $type"); header("Content-Disposition: attachment; filename=\"$data\""); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); - echo "$content"; + readfile($local); + unlink($local); die; } else {
With this patch, I had succesfully downloaded (as a test) a 162 MB file with PHP memory_limit set to 128 MB.- Workaround
- Priority
- 25
- Demonstrate Bug on Tiki 19+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 3690
- Created
- Thursday 02 December, 2010 16:34:14 UTC
by yajo - LastModif
- Tuesday 30 June, 2026 10:28:03 UTC