Forum

Thread tagged as: Problem, Error

500 Error on trying to save a region

I have a template set up with an image, textarea, and checkbox (multiple items), and on saving I end up on a 500 Error page. It seems to error out when selecting some images, but work fine with others from the Assets bucket.

Diagnostics report HEALTH CHECK

Perch is up to date PHP 5.5.32 is up to date MySQL 5.6.24-log is up to date Image processing available SUMMARY INFORMATION

Perch: 2.8.29, PHP: 5.5.32, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $, with MySQLi Server OS: WINNT, cgi-fcgi Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29) App runtimes: <?php $apps_list = array( 'content', 'categories', ); PERCH_LOGINPATH: /perch PERCH_PATH: C:\Websites\sherwoodinn.ca\www\perch PERCH_CORE: C:\Websites\sherwoodinn.ca\www\perch\core PERCH_RESFILEPATH: C:\Websites\sherwoodinn.ca\www\perch\resources Image manipulation: GD PHP limits: Max upload 64M, Max POST 8M, Memory: 128M, Total max file upload: 8M F1: 2edba60ed1f613d6dd804feb202456a2 Resource folder writeable: Yes SCRIPT_NAME: /perch/core/settings/diagnostics/index.php REQUEST_URI: /perch/core/settings/diagnostics/ DOCUMENT_ROOT: C:\Websites\sherwoodinn.ca\www HTTP_HOST: sherwoodinn.ca

Chad Tiffin

Chad Tiffin 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

A 500 error is an error notification. You will need to look in your PHP error log to see what the actual error is. If that doesn't help then paste it in here so we can see it.

We also need to see your template to be able to offer help.

Here's the error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 6822401 bytes) in C:\Websites\sherwoodinn.ca\www\perch\core\lib\PerchImage.class.php on line 726

Here's my template:

<div class="slide" style="background-image:url(<perch:content type="image" id="image" label="Image" help="For best results upload photos that are at least 1600px across" width="1600" required="true" bucket="slideshow" />);">
    <div class="wrapper">
        <div class="caption"><perch:content type="textarea" html="true" id="caption" label="Caption" help="Wrap text in &lt;span&gt; tags to style text with the special font (ex. &lt;span&gt;A&lt;/span&gt;ll four seasons)" size="s" /></div>
    </div>
</div>
<perch:content id="show" type="checkbox" suppress="true" value="exclude" label="Exclude from Pool" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

How many items do you have? Does it help if you switch to not edit all on one page within the region options?

There are 24 items, most with high resolution images the client has uploaded (> 5mb).

Switching to editing each item on its own page did not help.

EDIT: I take that back, only a few are high-res images. Most are under 2-300kb. The image that causes the error is ~5mb, however I tried a different image, that's ~8mb, and it works fine.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What sort of server is it?

Windows server (not my choice).

I was able to temporarily fix the problem by increasing PHP's memory_limit setting from 128M to 256M.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That sounds like the solution. If you're resizing large images, PHP needs to be able to hold the uncompressed image in memory to be able to do that. If your server is also shared with other users, that full memory allocation isn't guaranteed to be available - this is just the maximum a script is permitted to use.