Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Improve memory management  (Read 6934 times)

0 Members and 1 Guest are viewing this topic.

Veronica

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: se
  • Offline Offline
  • Posts: 106
  • Coppermine 1.5.22
Improve memory management
« on: January 10, 2013, 01:04:30 am »

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

Quote
To 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

Quote
ini_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
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Improve memory management
« Reply #1 on: January 10, 2013, 08:52:38 am »

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.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Improve memory management
« Reply #2 on: January 10, 2013, 11:19:15 am »

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
Code: [Select]
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.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.