Jump to content
JMH

Internal Server Error when uploading an image

Recommended Posts

Hi all,

I'm trying to upload an image to a blog post. The ProcessWire blog editing page is relatively simple. See attached. When I try to add more images and publish the post an internal server error is returned and a blank space is where the additional images should be. 

Can anyone advise on how this can be resolved quickly.

Please let me know any additional information you'd need. 

Many thanks.

JMH 

 

Internal Server Error 500.png

Blog Editing Page.png

Share this post


Link to post
Share on other sites

Errors like this are often caused by too large images. When you request a certain size, both the original image and the resized one (plus some computational overhead) have to be read into the main memory, so it's possible you're hitting PHP's memory limit.

Share this post


Link to post
Share on other sites

Am I seeing things, or are you actually running the TinyMCE module instead of the default CKEditor? What version of PW?

 

  • Like 1

Share this post


Link to post
Share on other sites
16 hours ago, BitPoet said:

Errors like this are often caused by too large images. When you request a certain size, both the original image and the resized one (plus some computational overhead) have to be read into the main memory, so it's possible you're hitting PHP's memory limit.

Thanks for getting back to me. Is there a standardised memory limit for PHP. I've resized the files and used compressed versions, but i still see the same error. My hosting provider has come back with the following feedback any additional thoughts:

2) Internal Error 500) 
The error logs show the following: 
[Tue Oct 11 09:06:57 2016] [error] [client 199.16.156.125:53266] Script timed out before returning headers: index.php
[Tue Oct 11 09:07:04 2016] [warn] [client 199.16.156.125:56282] AH01220: Timeout waiting for output fromCGI script /home/sites/public_html/index.php
[Tue Oct 11 09:07:04 2016] [error] [client 199.16.156.125:56282] Script timed out before returning headers: index.php
[Tue Oct 11 09:11:57 2016] [warn] [client 199.16.156.125:53266] AH01220: Timeout waiting for output fromCGI script /home/sites/public_html/index.php
[Tue Oct 11 09:12:04 2016] [warn] [client 199.16.156.125:56282] AH01220: Timeout waiting for output fromCGI script /home/sites/public_html/index.php

Why the site is taking so long to run the script, I'm unable to see why - but we cut off scripts from running longer than 30 seconds. This isn't something we're able to bypass. If the image you're trying to upload is rather large, it could be taking a while for the CMS to process it which is why it fails.

 

 

 

Share this post


Link to post
Share on other sites

PHP's memory limit is an ini setting just like the maximum script execution and set by your hoster. Perhaps you can try with a truly small image and see if this works, just to make sure it is really a case of the script taking too long vs. the script crashing without the CGI handler realising it. If this works, you could try and go up in steps to get a feel where the size limit is. I'm not sure what's the best way to get some sensible debugging information about that, perhaps someone more familiar with the image modules can chime in here.

  • Like 1

Share this post


Link to post
Share on other sites
16 hours ago, adrian said:

Am I seeing things, or are you actually running the TinyMCE module instead of the default CKEditor? What version of PW?

 

New to ProcessWire, must be an old version. Is CKEditor out of beta now?

Share this post


Link to post
Share on other sites
1 minute ago, JMH said:

New to ProcessWire, must be an old version. Is CKEditor out of beta now?

CkEditor itself has been around for a very long time and the default editor in PW since July 2014 :)

Before you do anything else, go grab the latest version of PW here: https://github.com/processwire/processwire

  • Like 1

Share this post


Link to post
Share on other sites
11 minutes ago, adrian said:

CkEditor itself has been around for a very long time and the default editor in PW since July 2014 :)

Before you do anything else, go grab the latest version of PW here: https://github.com/processwire/processwire

Great, thanks Adrain. As i mentioned the team is new to PW, so I'm wary of the update being problematic. 

Share this post


Link to post
Share on other sites

With newer PW versions there is, besides a billion other new goodies, also integrated memory checking before trying to manipulate / create a(n) image / variation.

  • Like 1

Share this post


Link to post
Share on other sites
20 hours ago, adrian said:

CkEditor itself has been around for a very long time and the default editor in PW since July 2014 :)

Before you do anything else, go grab the latest version of PW here: https://github.com/processwire/processwire

So it looks like I'm running version 2.3.0 of ProcessWire that dates back to 2013. Seems like an upgrade is in dire need. My hosting provider's servers are using the following versions of software. Can you advise on the best version to upgrade to please? Also will this solve the issue with image uploads?? 

  • Apache 2.4.6 with all standard modules installed, including mod_rewrite
  • MySQL version 5.5.32 (MySQL version 5.1.73 for unmanaged servers)
  • PHP version 4.4.9 with Zend Optimiser version 3.3.3
  • PHP version 5.2.17 with Zend Optimiser version 3.3.9
  • PHP version 5.3.27
  • PHP version 5.4.16
  • PHP version 5.5.1
  • Perl version 5.10.1 with Crypt::SSLeay module version 0.57
  • Python version 2.6.6
  • Ruby version 1.8.7 and eRuby (embedded Ruby)
  • Image::Magick version 6.8.3-6
  • GD version 2.3.5
  • CURL version 7.19.7

 

Share this post


Link to post
Share on other sites

The server software looks good. I would select PHP 5.4.x or higher.

Upgrading to PHP 2.7, the legacy Version at a first step should be relatively safe, depending on the third party modules you run into that site.

Can you post a list of all installed and used site/modules ?

Regardless of that, you first should backup a mysql dump and the complete site folder!

If you can, you than should install (locally?) a copy of that site and test the upgrade there.

If not, it is also possible to do it on the live site, if you:

  • can set it into maintenance mode some how
  • have an external access to the mysql DB for backup and restore operations

 

  • Like 2

Share this post


Link to post
Share on other sites
3 minutes ago, horst said:

The server software looks good. I would select PHP 5.4.x or higher.

Upgrading to PHP 2.7, the legacy Version at a first step should be relatively safe, depending on the third party modules you run into that site.

Can you post a list of all installed and used site/modules ?

Regardless of that, you first should backup a mysql dump and the complete site folder!

If you can, you than should install (locally?) a copy of that site and test the upgrade there.

If not, it is also possible to do it on the live site, if you:

  • can set it into maintenance mode some how
  • have an external access to the mysql DB for backup and restore operations

 

I've downloaded the full site (1.7GB) and mysql (1.9MB). Also created a copy of the site for non-production version to test the upgrade with. All the modules used should be in images attached. At least I think they're all listed. Thanks for getting back to me. Much appreciated. 

Production Site Modules.png

Wire Modules1.png

Wire Modules2.png

Wire Modules3.png

Wire Modules4.png

Wire Modules5.png

Wire Modules6.png

Wire Modules7.png

Share this post


Link to post
Share on other sites

As a side note: you have the install (sub)folder in your production site? (this should be deleted on production sites after successful installation)

There are not much third party modules. Following these steps should do it, hopefully:

  • start your local copy and check if everything is working as expected, front and backend
  • make a mysql dump of the local DB
  • download the PW 2.7 legacy version
  • rename your existing wire folder to wire.2-3, your index.php to index.php.2-3 and the .htaccess to .htaccess.2-3
  • copy the wire folder, the index.php and the .htaccess (htaccess.txt => .htaccess) from the PW 2.7 distribution to your local copy
  • now load / reload a multiple times the backend and look out for messages. (turn on $config->debug = true; in your site/config.php)

If this above steps will do, you additionally will need to change every html-editor textarea field type to work with CK-Editor, instead of the old, (now in the core missing TinyMCE). I don't recall any other things should take care of. The site/templates-admin/ folder can be deleted in your site profile too, after the successful upgrade to 2.7.

If there will raise any other issue, please come back here and tell us. :)

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, horst said:

As a side note: you have the install (sub)folder in your production site? (this should be deleted on production sites after successful installation)

There are not much third party modules. Following these steps should do it, hopefully:

  • start your local copy and check if everything is working as expected, front and backend
  • make a mysql dump of the local DB
  • download the PW 2.7 legacy version
  • rename your existing wire folder to wire.2-3, your index.php to index.php.2-3 and the .htaccess to .htaccess.2-3
  • copy the wire folder, the index.php and the .htaccess (htaccess.txt => .htaccess) from the PW 2.7 distribution to your local copy
  • now load / reload a multiple times the backend and look out for messages. (turn on $config->debug = true; in your site/config.php)

If this above steps will do, you additionally will need to change every html-editor textarea field type to work with CK-Editor, instead of the old, (now in the core missing TinyMCE). I don't recall any other things should take care of. The site/templates-admin/ folder can be deleted in your site profile too, after the successful upgrade to 2.7.

If there will raise any other issue, please come back here and tell us. :)

Thanks Horst. Just spoke with hosting provider and they've said I can create dev folder in public_html and test the upgrade files through their file manager. Does this make sense to based on everything you've advised so far? 

Dev 1 copy.png

Share this post


Link to post
Share on other sites

What you need is a complete copy of your production site. That includes all files from wire and all files from site, plus index.php and .htaccess. Additonal to this you need a dev-mysql DB that is an exact copy of that DB of your production site. ATTENTION: the site/config.php file of your dev-copy need to be adjusted to point to the dev-DB, and not to the production DB anymore!

The dev-copy should be on its own domain or subdomain. How can you call / access your dev-copy via HTTP?

It better should not exist in a subfolder of your production webroot.

If your production site is http://example.com/, the devcopy should NOT be accessible via http://example.com/devcopy/, but can be a subdomain like http://dev.example.com/

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By humanafterall
      I'm using some Custom fields for images: 
      https://processwire.com/blog/posts/pw-3.0.142/#custom-fields-for-files-images

      When I save the page, and return the fields are blank. When I re-add the text to the fields and save again then the fields save as expected.

      I know this is stated as being quite experimental but it's super useful feature I'd love to get working correctly.
      I have fields that are CKEditor fields but have overidden this on the image specific template. I've also tried it with regular text fields and I get the same bug.
      (currently using Processwire 3.0.155)
      **UPDATE**
      I've found this issue is specific to editing on pages using the PageTable fieldtype. The fields are not saving when I save the page in the PageTable.
    • By Robin S
      Displays image tags overlaid on the thumbnail using customisable colours. This makes it easier to see which images have which tags without needing to open the edit pane for individual images or changing to the list view.
      Screenshot

      Usage
      Enable tags for one or more image fields. Install the Image Thumbnail Tags module. Optionally configure colours for any of your tags.
       
      https://github.com/Toutouwai/ImageThumbnailTags
      https://modules.processwire.com/modules/image-thumbnail-tags/
    • By EyeDentify
      Hello dear PW gurus.

      I have stumbled over a strange error that i all of sudden got when trying to upload an image to a images field on a page.
      There where images allready stored in the field that i wanted to keep, but during the upload the error apear and after that all images are gone from the field and i can´t upload any, i just get the error every time.
      I am running ProcessWire 3.0.153 dev.
      Update:
      After looking in the assets folder i find the folder for the page and the image files seems to be there including the ones i tried to upload when the error occured.
      But they don´t show up in the images field in the page editor.
       
      The error reported:
       
      SQLSTATE[01000]: Warning: 1265 Data truncated for column 'ratio' at row 1 And here is a screenshot of the event:

      The TracyDebugger Error reporting:

      I hope you fine folks could point me in a direction.
      But it seems our old pal set_time_limit() is back.

      Regards, EyeDentify
    • By Peter Knight
      If an image is added to a site via the rich text field, do we have a way to apply a custom wrapper or mini template to it?
      IE I want to apply some markup srcset to some user added images. I can only seem to achieve this when the image markup is in the template itself.
      https://github.com/rolandtoth/MarkupSrcSet/wiki
      I can probably achieve this with RepeaterMatrix and by creating a specific Images field (and images template) but outside of that ?
      Thanks
    • By Andi
      Continuing my journey into PW hooks, I'm trying to find a way to retrieve all images from a page that explicitly *do not* have a certain tag (or tags) attached to them.
      Found this post from 2015
      But I'm wondering if there's a more elegant way to go about this.
      Let's say I have a multi-image field called "images_header" and instead of
      $page->images_header->findTag('mytag'); I would like to do this:
      $page->images_header->excludeTag('mytag'); So I'd be able to do
      // find images that don't have the tag "mytag" $images = $page->images_header->excludeTag('mytag'); // check if there's any images if (count($images)>0) { // do something.. } Would this be possible by hooking into Pagefiles somehow?
      There's this bit in /wire/core/Pagefiles.php Line 626 that I'd basically just need to reverse (or at least in my mind 😄 )
      public function findTag($tag) { $items = $this->makeNew(); foreach($this as $pagefile) { if($pagefile->hasTag($tag)) $items->add($pagefile); } return $items; } Any ideas on how this could be done in a graceful manner?
      Thanks in advance!
×
×
  • Create New...