Fatal error: Allowed memory size of X bytes exhausted Fatal error: Allowed memory size of X bytes exhausted
 

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

Fatal error: Allowed memory size of X bytes exhausted

Started by hyperion, April 30, 2004, 03:19:27 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

hyperion

Error Message:

Fatal error: Allowed memory size of XXXXXXX bytes exhausted at (null):0 (tried to allocate XXXX bytes) in /var/www/html/include/picmgmt.inc.php

Meaning:  You have exceeded the memory allotment given to you in php.ini

Possible causes:

This error occurs when using GD and attempting to upload a high resoltuion image.  It's not the size of the file that matters here; it's the number of pixels that determine memory use in GD. 

Solutions:

Alternative 1 (ideal):Increase the memory limit allocation in php.ini. You must be the server's administrator to do this. Also, .htaccess files cannot change this configuration setting, and it cannot be changed using ini_set(). First, you locate the following block in php.ini: 


;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60        ; Maximum amount of time each script may spend parsing request data
memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)


Now you increase the memory limit to fir your needs. 9 to 16 MB should handle most requirements. To calculate the amount of memory an image uses, you simply multiply the pixel width and height, and then you multiply the result by the number of base colors (RGB - 3, CMYK - 4). Finally, you divide by 1048576 to get the memory usage in MB.

Here are some common image resolutions and their memory use in GD (assuming RGB):

800 x 600 - 1.37 MB
1024 x 768 - 2.25 MB
1200 x 1600 - 5.49 MB

Remember when using the above figures that the amount of memory being used by the rest of Coppermine must be taken into account, too.

If you are unable to change php.ini settings yourself, you can always ask your server administrator to change this for you.  However, many administrators will be reluctant to do so, as this setting will affect everyone on a shared server.  A higher memory limit requires reducing the number of people who can be hosted on the same server in order to maintain server stability. This reduces profitability, etc.

If you cannot change php.ini, you should read alternatives 2 and 3.

Alternative 2 (sensible):

Resize your images before uploading if you do not require high resolution images.  This saves upload bandwidth and time for you.

Alternative 3 (workaround):

You may download one of many free programs that resize images. Then resize the images to a smaller resolution (like 800 x 600) by the batch into a different folder while maintaining the same filenames.

Upload the resized images to Coppermine.  Then use your FTP client to overwrite the images with the higher resolution images. 

N.B. Users who are not members of the same group as the server may have difficulty using FTP to overwrite the files.
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

hamster

#1
if you place this command:

ini_set ( "memory_limit", "24M");

at the beginning of your resize script (merely after the < ? php tag)

it will increase the memory usable by your script, so you can resize bigger images [Big Grin]

24M = 24megabytes

on my resize script i use it setted to 32M (32mb) and till now i've resized corretly images till 4096*4096... i've never tryied above [Big Grin]

cya

Joachim Müller

This does only apply if your webhost let's you change it - most webhosts don't. In other words: works for you, might work for some other folks, won't work for the majority of users.

Joachim

hamster

Usin ImageMagick in coppermine, is all ok.


--------------

La mejor solucion es cambiar el GD y elegir ImageMagick, en el apartado de configuracion del coppermine.


HeAtHeN

Quote from: hyperion on April 30, 2004, 03:19:27 AM
Meaning:  You have exceeded the memory allotment given to you in php.ini

And where exactly is this php.ini file located....

light the fire whitin

Hein Traag

If you can't find it using the rights you have on the server, and i assume you have searched before asking, then it might be wiser to ask your host to do the editing.

blackgryffin

hello

same problem here. But what it could be very usefull, is to tell how to find this php.ini and what to do exactly to change this limit of 8mega  ;)

i'm testing coppermine by now and i really need to keep the high resolution of the jpeg inside my albums  :-\\ so ... can't resize ...

thanx for yours answers and your help !

Nibbler

If you are running the server yourself then you will know where it is. If you are not running the server yourself then you probably won't be able to change it even if you know where it is, you'll need to ask whoever does run the server. A phpinfo() file

<?php phpinfo(); ?>

will tell you the Configuration File (php.ini) Path.

blackgryffin

I finally found where it was and believe me, it was everything except obvious ...

I changed my ftp client for another one which shows invisible files ...... it is on the first directory of your files on ftp, directory "called" /

then go to directory : etc

there is the php.ini

/etc/php.ini

:P

sorry guys but if you knew it, it wouldn' be so difficult to tell it ... b'cause if it is the solution, it is great for newbies to go on instead losing times in wrong directions !!!

thanx anyway ... my next question is : what is the maximum limit to this memory limit in php.ini ? i mean without corrupting anything ?

thanx  :-X

Joachim Müller

as suggested above: you shouldn't be running your own server if you have no idea about server setups: the php.ini can reside in different locations, depending on your server setup, so we simply wouldn't have been able to tell you even if we wanted to. For you, it's in /etc/, for others it might be somewhere else - your nagging just isn't helpfull, but irrelevant and hust shows you have no idea!
Additionally, it's not our fault that you haven't properly configured your FTP app.

You might have noticed that we have a "one question per thread" policy on this board (you agreed to respect it when you signed up for your account). Replying to a sticky thread that even is labelled "FAQ" is not a bright idea, especially if you don't show respect to supporters nor board rules by trying to hijack it with "next questions".

To find out details about server setup, go to the pages that deal with server setup (in your case, php.net would be a good place to start with), or buy a good book. Coppermine is an application that has a running and properly configured webserver as minimum requirement, we can not hold your hand through the process of setting your server up in the first place.

To stop people from posting to this thread, I once again locked it.

Joachim

Joachim Müller

Instead of just accepting this thread was locked to avoid further flaming, blackgryffin went ahead and sent me a PM. Since I don't want to be contacted by PM, I thought I'd post it here for others to make up their mind on blackgryffin's attitude:
Quote from: blackgryffin
Hello

First, i'm a bit surprised by such your attitude ! you are very affirmative but are you so sure you have the right point of view ?

1) i do not run "my own web server" i have a website on a web server.
2) i can easyly believe that a php.ini can reside anywhere else than a etc directory but the point is if a web server as the one i use, with php, mysql, perl,cgi and eveything put a php.ini in a etc directory, i would be surprised if it was so different on another serious webserver ......... maybe tomorrow i'll put my fonts folder into my documents folder ... just to see if my system is different from the one of my neighbour ...
3) you are very affirmative when you say that i have no idea ! lolololol incredible how pretentious you are ! maybe it's true, maybe it's not, but what is sure, you do not have my permission to tell such things or to insult my brain. Maybe you are a devellopper and sure i am a newbie but newbie doesn't mean blind, stupid, dumb and deaf !
4) if you haven't closed the topic where i wrote, i could easily say sorry and bring details of my configuration. But it will never happen now.
5) So, my ftp app is not properly configured ... strange ... i'm going to write to the ftp devellopper to tell him : by the hell ! your client is a crap ! lololol pathetic answer when you even don't know what is this ftp client. I ne-ver said it was a professional one, it's just a little free one.
6) sorry to "hijack" : i didn't know to put ONE answer and ONE question in the same thread was so unpolite ! Oo
7) as i'm not running my own web server as mentionned in 1) and 2) i think it's urgent i tell to the technical support of the web server i run that the big one you are is sure their server is a whole crap and their php and sql a shame for the developpers of coppermine !!!
8) lucky you are i'm just a newbie, b'cause when you write such things, you seem speaking in the name of all the developpers of your project and in the name of your product itself ... it's a dangerous attitude to get so nervous in front of a simple newbie as i mentionned in the the topic ...
9) yes coppermine seems great, but why after only 9 jpeg in high resolution, the thumbnails don't load ? but maybe you could ask why i need to keep my jpeg in a high resolution, and then a simple conversation could be done, instead of your such pretentious and rudeness attitude.

I hope your product is better than your attitude. If i have to learn php, you have to learn something else. If you don't see what, i feel pityfull for you.

blackgryffyn
It's those nice users as blackgryffin that keep me working on this project, people with this kind of attitude make me realize that the team's effort if appreciated ::) :\'(

Joachim

DJMaze

ehm blackgryffin could you tell me which one i need to edit ? ;D
root@secure [~]# locate php.ini
/home/cpapachebuild/buildapache/php-5.0.4/pear/tests/php.ini
/home/cpapachebuild/buildapache/php-5.0.4/php.ini-recommended
/home/cpapachebuild/buildapache/php-5.0.4/php.ini-dist
/home/cpzendinstall/ZendOptimizer-2.5.7-linux-glibc21-i386/zui_files/php.ini
/home/cpphpbuild/php-4.3.9/pear/tests/php.ini
/home/cpphpbuild/php-4.3.9/php.ini-recommended
/home/cpphpbuild/php-4.3.9/php.ini-dist
/usr/lib/php.ini
/usr/local/lib/php.ini
/usr/local/lib/php.ini.new
/usr/local/lib/php.ini-zend_optimizer.bak
/usr/local/lib/php.ini.save
/usr/local/cpanel/3rdparty/etc/php.ini
/usr/local/cpanel/3rdparty/lib/php.ini
/usr/local/Zend/etc/php.ini
/usr/local/Zend/etc/php.ini-zend_optimizer.bak
/usr/local/Zend/etc/php.ini.bak
/var/cpanel/version/php.ini-2


root@secure [~]# umount brains
brains successfully unmounted
root@secure [~]# mount -L RTFM
RTFM successfully mount
root@secure [~]# /RTFM/php
no such index, try http://docs.php.net/
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0

Joachim Müller