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.
Using readfile instead of file_get_contents. Here's the patch:
Index: 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.
To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tikiwiki.org instance. To start, simply select a version and click on "Create show2.tikiwiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tikiwiki.org.
filename | created | hits | comment | version | filetype | ||
---|---|---|---|---|---|---|---|
No attachments for this item |