forum.coppermine-gallery.net

Support => cpg1.6.x Support => cpg1.6 miscellaneous => Topic started by: Hanna. on March 14, 2023, 03:39:32 pm

Title: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate
Post by: Hanna. on March 14, 2023, 03:39:32 pm
Hey guys. I came across an old thread on this (version 1.3 and below.) I'm currently running version 1.6 and getting this error.

My image is not even 1Mb. My php ini is 2040Mb so I just don't understand what the deal is. I'm trying to upload 1 image, size 3000x2000px. Error receiving:

Quote
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 4096 bytes) in /home/public_html/include/debugger.inc.php on line 111

Could this be related to anything else than the memory limit? What am I missing?
Title: Re: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate
Post by: Joe Carver on March 14, 2023, 04:09:18 pm
Take a look at the documents: Upload Troubleshooting  (https://coppermine-gallery.net/docs/curr/en/upload_troubleshooting.htm#upload_trouble)

To quote:
Quote
It's not the size of the file that matters here; it's the number of pixels that determine memory use in GD.

There are solutions that you can try.
Title: Re: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate
Post by: Hanna. on March 14, 2023, 04:19:23 pm
Take a look at the documents: Upload Troubleshooting  (https://coppermine-gallery.net/docs/curr/en/upload_troubleshooting.htm#upload_trouble)

To quote:
There are solutions that you can try.

Thanks.

This still doesn't make any sense. I already uploaded way bigger images without issues. Some images are over 1Mb and 4500px. This is the first time I'm seeing this error in years.
Title: Re: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate
Post by: Hanna. on March 14, 2023, 04:25:30 pm
I had to go down to 600px to get one image uploaded. Then I replaced it via FTP to bigger and ran the Admin tools. This is just bizarre though.
Title: Re: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate
Post by: Joe Carver on March 15, 2023, 08:41:16 pm
Check with your host and/or maybe look at your cPanel  to see what physical memory is available when you are uploading.

No issue seen on a test of a 4368x2312px (5.3Mb) file uploaded via HTML5 as well as others on CPG 1.6.22.

On second look, there is definitely something wrong in the numbers that your error message showed.
Quote
Fatal error: Allowed memory size of 536870912 bytes exhausted

That might indicate by itself that the problem lies elsewhere and has used up the memory on the server before you tried uploads.
Title: Re: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate
Post by: ron4mac on March 15, 2023, 10:04:25 pm
Uploading files should really have nothing to do with what theme is being used at the time of upload but, unfortunately, the way the core of CPG was designed, a lot of stuff about the theme comes into play even during an upload. If the theme is a complex one with added actions, it may needlessly use some of the PHP memory in the upload process. So you might try doing uploads with a lightweight theme. Do you know the trick of temporarily using a different theme, Hanna?
<MY-GALLERY>/index.php?theme=water_drop
That will cause your current browser to use that theme until it is reset.
<MY-GALLERY>/index.php?theme=xxx
Title: Re: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate
Post by: Hanna. on June 14, 2023, 08:19:39 pm
Uploading files should really have nothing to do with what theme is being used at the time of upload but, unfortunately, the way the core of CPG was designed, a lot of stuff about the theme comes into play even during an upload. If the theme is a complex one with added actions, it may needlessly use some of the PHP memory in the upload process. So you might try doing uploads with a lightweight theme. Do you know the trick of temporarily using a different theme, Hanna?
<MY-GALLERY>/index.php?theme=water_drop
That will cause your current browser to use that theme until it is reset.
<MY-GALLERY>/index.php?theme=xxx

Just saw this now. Yes, indeed I tried this method. I am not even trying to upload big stuff (max 2048px) and all I get is:

Code: [Select]
Fatal error: Uncaught TypeError: readdir(): Argument #1 ($dir_handle) must be of type resource or null, bool given in /public_html/searchnew.php:238 Stack trace: #0 /public_html/searchnew.php(238): readdir() #1 /public_html/searchnew.php(394): getfoldercontent() #2 /public_html/searchnew.php(570): CPGscandir() #3 {main} thrown in /public_html/searchnew.php on line 238
Title: Re: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate
Post by: Hanna. on June 16, 2023, 04:22:01 am
I went through the stub (https://forum.coppermine-gallery.net/index.php/topic,79013.0.html), deactivated all plugins and theme (now running theme water_drop) and still getting this error.
Title: Re: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate
Post by: Hanna. on June 16, 2023, 04:23:29 am
Attaching debug info.