Jump to content

Internal Server Error when uploading an image


JMH
 Share

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

Link to comment
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.

Link to comment
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.

 

 

 

Link to comment
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
Link to comment
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?

Link to comment
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

 

Link to comment
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
Link to comment
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

Link to comment
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
Link to comment
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

Link to comment
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
Link to comment
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
 Share

×
×
  • Create New...