Improve memory management Improve memory management
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Improve memory management

Started by Veronica, January 10, 2013, 01:04:30 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Veronica

When reading this forum default reply message when uploads fail with exhausted memory messages
http://documentation.coppermine-gallery.net/en/upload_troubleshooting.htm#upload_error_messages_allowed_memory_size
http://documentation.coppermine-gallery.net/en/upload_troubleshooting.htm#upload_trouble_memory_usage

it's outdated alot saying that memory increase can't be done with ini_set

QuoteTo increase the memory limit allocation in php.ini, you must be the server's administrator.
Also, .htaccess files cannot change this configuration setting, and it cannot be changed using ini_set().
This being said, most coppermine users who are on shared webhosting will not be able to change this.

PHP Manual says PHP_INI_ALL (Entry can be set anywhere) for memory_limit
http://php.net/manual/en/ini.core.php

I have one of my accounts at http://www.one.com/en/ which is a very low-cost hosting company in Denmark with currently 1 Million accounts.

I made a test of increasing memory like this

Quote<?php
    print '<br>ini_get memory_limit: ' . ini_get('memory_limit');
    ini_set('memory_limit', '128M');
    print '<br>ini_get memory_limit: ' . ini_get('memory_limit');
    print '<br>';
    $x = array();
    for($i = 1; $i > 0; $i++) $x[$i] = 1.0;
?>

with this result

Quoteini_get memory_limit: 80M
ini_get memory_limit: 128M
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20 bytes) in .................

Which proves that I got the 128M being requested instead of host configuration of 80M

Conclusion why don't you ask for more memory in picmgmt.inc.php and try to request enough memory to avoid the exhausted message?
Better make the required memory size configurable for the gallery owner
During installation you can also determine if there is an upper limit for memory size increase

Asking users to resize their pictures before upload is not 2013 style

phill104

I personally think that is not an option. It is up to the webmaster to set suitable limits and also up to the host. We see many hosts that threaten to pull their clients for various reasons and if a script is fiddling with their memory limits in a core file then that gives them more ammunition. This is why we advise on various methods of doing this, methods that the webmaster can control.

The better way IMHO is for us to look at a future upload script that will be a bit more efficient and maybe resize during upload. There are HTML 5 uploaders that do this.
It is a mistake to think you can solve any major problems just with potatoes.

ΑndrĂ©

I share Phill's opinion. It's no option that Coppermine changes the server limits by default. Additionally, not all hosts allow ini_set, which will result in error messages like
Warning: ini_set() has been disabled for security reasons
(which could of course be suppressed by using @ini_set).

It would be possible to add is as an option to cpg1.6.x, but as people don't read and often set stupid high values it's maybe better to create a plugin for this purpose, so those people don't have any chance to blame Coppermine that their hosts have kicked them. Such a plugin is probably created quite fast and would be also available for cpg1.5.x.

Automatically resizing pictures during upload (according to the gallery settings) would of course be great, but doesn't ensure that there will be sufficient memory to process the uploaded pictures. But I think we should schedule such an uploader for cpg1.6.x.

I think we can avoid some support requests if we combine both the plugin and the new uploader.


Moving to feature requests board.