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: [SOLUTION] Fatal error: Allowed memory size of X bytes exhausted  (Read 2955 times)

0 Members and 1 Guest are viewing this topic.

Johnneke

  • Coppermine newbie
  • Offline Offline
  • Posts: 2

Hello everyone, just like many others I had the Fatal error: Allowed memory size of X bytes exhausted. Quickly finding the stickied post but that was a huge bummer as this was what it said:

Quote
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().

I tried the other alternatives but even pictures at 640x480 didnt got through the standard 8M that php is set at.
Now out of curiosity I went to the Gallery 2 forums to see what they said about this error (It's a php error so every gallery using gd will do the same) and I was amazed to see them stating the opposite of the admin on this board!

.htaccess CAN CHANGE this setting
and it CAN BE CHANGED using ini_set().

I'm running coppermine integrated in a joomla installation with search engine friendly links so I was already using a .htaccess file so I went ahead and tried what they said at Gallery 2 FAQ. Here it is, it DID fix the solution to me completely, while not being able to upload 640x480 pics I can now upload high res photo's as you can see on http://www.huisdierengedrag.be/gallerij. As a sight note, the ini_set() command shown here is specific for gallery 2 installations, if anyone can figure out if which php file it goes of the cpg installation that would be great ;)

Quote from Gallery 2 FAQ:

You are exhausting the available memory that PHP has access to. In php.ini there is a config variable named memory_limit that by default is set to 8MB. Edit php.ini and increase it to a larger value (restart Apache afterwards). If you don't have access to php.ini, you can add this line to your .htaccess file in your gallery2 folder. Usually, unless you are the owner of the server, you don't have access to change php.ini. If there is no .htaccess file yet, you can create one (it's just a text file with the name '.htaccess').
Code: [Select]
php_value memory_limit [new memory limit]
To change it to 24 MB, write:
Code: [Select]
php_value memory_limit 24M
If the .htaccess method does not work or if you get an internal server error after adding this line, remove the line from the .htaccess again. You can also try to change the memory_limit by adding the following line right after '<?php ' in install/index.php and in main.php:
Code: [Select]
ini_set("memory_limit","32M");
Logged

Johnneke

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: [SOLUTION] Fatal error: Allowed memory size of X bytes exhausted
« Reply #1 on: July 08, 2007, 06:51:25 pm »

Oh BTW I'm not the server administrator or anything, I use paid hosting on a shared enviroment and the .htaccess fixed it for me, it will most likely NOT work on free hosts
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [SOLUTION] Fatal error: Allowed memory size of X bytes exhausted
« Reply #2 on: July 09, 2007, 07:55:03 am »

Thanks for sharing your insight. However, your solution will not work for most on shared webhosting. The amount of allowed memory consumption is crucial for the number of shared hosting accounts a webhost can have on one server, that's why most webhosts disable both the .htaccess method as well as the PHP-method. However, for some your suggestion may work, so you're right: we should review the corresponding section in the sticky thread and clartify that there may be an option for some to overcome the memory limitations using the methods discussed.
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 22 queries.