Can’t upload Images to WordPress – Error 500 Response

I’m having a really frustrating issue whereby I can’t seem to upload any images to WordPress in a post content or via the browser uploader, multi-file uploader.

When uploading a single image directly into Gutenberg I get the loading animation for ages and then a “The response is not a valid JSON response” error. The AJAX response is an error 500. The same thing happens when trying to upload images via the browser uploader in the WordPress media tab.

The server logs are as follows at the time of the 500 response:

2020-02-12 12:42:27.626436 [INFO] [-Q:CB9E669F502E857E-215#wordpress] [REWRITE] detect external loop redirection with target URL: https://domain.com/wp-admin/admin-ajax.php, skip.

2020-02-12 12:42:38.421757 [INFO] [-Q:CB9E669F502E857E-163#wordpress:lsapi] Connection idle time too long: 301 while in state: 6 watching for event: 8452, close!

2020-02-12 12:42:38.422072 [INFO] [-Q:CB9E669F502E857E-163] Content len: 288523, Request line:

POST /wp-json/wp/v2/media?_locale=user HTTP/1.1

2020-02-12 12:42:38.422211 [INFO] [-Q:CB9E669F502E857E-163] Redirect: #1, URL: /index.php

This problem seems to have cropped up very recently as I have previously uploaded images without any issues whatsoever. My WordPress installation is using a custom theme and several plugins but reverting to a default theme and disabling all plugins doesn’t seem to resolve the issue. I have also tried reverting my WordPress installation itself to an earlier version which again, has no effect in solving the issue.

This is leading me to believe the problem must lie with the server however I’m not particularly sure what the issue could be there either.

The server is a Digital Ocean OpenLiteSpeed WordPress “pre-set” (https://marketplace.digitalocean.com/apps/openlitespeed-wordpress) running on a 2GB droplet.

I’ve installed a WordPress Site Health Plugin and the data with regards to my particular installation and set up is below:

### wp-core ###

version: 5.3.2
site_language: en_GB
user_language: en_GB
https_status: true
user_registration: 0
default_comment_status: open
multisite: false
user_count: 1
dotorg_communication: true

### wp-paths-sizes ###

wordpress_path: /var/www/html
wordpress_size: 842.34 MB (883256225 bytes)
uploads_path: /var/www/html/wp-content/uploads
uploads_size: 679.64 MB (712654023 bytes)
themes_path: /var/www/html/wp-content/themes
themes_size: 2.17 MB (2272815 bytes)
plugins_path: /var/www/html/wp-content/plugins
plugins_size: 70.21 MB (73618620 bytes)
database_size: 11.55 MB (12107776 bytes)
total_size: 1.57 GB (1683909459 bytes)

### wp-dropins (1) ###

advanced-cache.php: true

### wp-themes-inactive (1) ###

Twenty Twenty: version: 1.1, author: the WordPress team

### wp-plugins-active (12) ###

Advanced Custom Fields: version: 5.8.7, author: Elliot Condon
Coming Soon Page, Under Construction & Maintenance Mode by SeedProd: version: 5.1.0, author: SeedProd
Contact Form 7: version: 5.1.6, author: Takayuki Miyoshi
Edit Author Slug: version: 1.6.1, author: Brandon Allen
Error Log Monitor: version: 1.6.9, author: Janis Elsts
Health Check & Troubleshooting: version: 1.4.2, author: The WordPress.org community
LiteSpeed Cache: version: 2.9.9.2, author: LiteSpeed Technologies
Media Cloud: version: 3.3.11, author: interfacelab
Minify HTML: version: 1.99, author: Tim Eckel
Smush: version: 3.4.2, author: WPMU DEV
WP Mail SMTP: version: 1.8.1, author: WPForms
WP User Avatar: version: 2.2.4, author: flippercode

### wp-media ###

image_editor: ILABMediaCloudToolsStorageStorageImageEditor
imagick_module_version: 1687
imagemagick_version: ImageMagick 6.9.7-4 Q16 x86_64 20170114
http://www.imagemagick.org
gd_version: bundled (2.1.0 compatible)
ghostscript_version: 9.26

### wp-server ###

server_architecture: Linux 4.15.0-76-generic x86_64
httpd_software: LiteSpeed
php_version: 7.3.14-1+bionic 64bit
php_sapi: litespeed
max_input_variables: 1000
time_limit: 90
memory_limit: 512M
max_input_time: 60
upload_max_size: 10M
php_post_max_size: 10M
curl_version: 7.58.0 OpenSSL/1.1.1
suhosin: false
imagick_availability: true

server-headers:
expires: Wed, 11 Jan 1984 05:00:00 GMT
cache-control: no-cache, must-revalidate, max-age=0
content-type: text/html; charset=UTF-8
link: Array
x-litespeed-tag:
fc6_tag_priv,public:fc6_front,public:fc6_URL.6666cd76f96956469e7be39d750cc7d9,public:fc6_F,public:fc6_Po.11,public:fc6_PGS,public:fc6_
x-litespeed-cache: miss
content-encoding: gzip
vary: Accept-Encoding
date: Tue, 11 Feb 2020 13:10:35 GMT
server: LiteSpeed
alt-svc: quic=”:443″; ma=2592000; v=”43,46″, h3-Q043=”:443″; ma=2592000, h3-Q046=”:443″; ma=2592000, h3-Q050=”:443″; ma=2592000, h3-24=”:443″; ma=2592000, h3-25=”:443″; ma=2592000
htaccess_extra_rules: true

### wp-database ###

extension: mysqli
server_version: 10.3.22-MariaDB-1:10.3.22+maria~bionic
client_version: mysqlnd 5.0.12-dev – 20150407 – $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $

### wp-constants ###

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /var/www/html/wp-content
WP_PLUGIN_DIR: /var/www/html/wp-content/plugins
WP_MAX_MEMORY_LIMIT: 512M
WP_DEBUG: true
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: true
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_LOCAL_DEV: undefined

### wp-filesystem ###

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable

Read more here:: Can’t upload Images to WordPress – Error 500 Response

Leave a Reply

Your email address will not be published. Required fields are marked *