Topic on Project:Support desk

500 Error on Uploaded File

5
Tim Spaulding (talkcontribs)

I have a new one click install of Mediawiki 1.23.9 on a shared server.

Running:

Red Hat Centos 6.x (not sure which)

PHP 5.6.14

ImageMagick 6.6.3

When I upload images using the Special:Upload the preview of the selected image displays and the upload executes without an error. However, the uploaded image does not render and when selected leads to a 500 error. I have tried .png, .jpg and .gif files with the same result.

This is the .htaccess file:

<IfModule mod_suphp.c>

    suPHP_ConfigPath /opt/php56/lib

</IfModule>

DirectoryIndex default.html

# Use PHP56 as default

AddHandler application/x-httpd-php56 .php

Only similar issue I have found while searching was related to a .htaccess issue but did not elaborate.

Help would be appreciated.

Ciencia Al Poder (talkcontribs)

Without a detailed error message (instead of a generic 500 error) there's nothing we can do... If you get the error on the image description page (which is a PHP error), see Manual:How to debug for information about how to display errors. If the file description page opens but the image is missing, and clicking on the image leads to an error page, you should check the webserver error logs, usually even shared servers have access to logs for their own domains.

Tim Spaulding (talkcontribs)

So for anyone else with this issue, I found that there is a .htaccess file in the images folder. That file has this code:

AddType text/plain .html .htm .shtml .php

   php_admin_flag engine off

# Protect against bug 28235

<IfModule rewrite_module>

RewriteEngine On

RewriteCond %{QUERY_STRING} \.[^\\/:*?\x22<>|%]+(#|\?|$) [nocase]

RewriteRule . - [forbidden]

</IfModule>

Web searched on bug 28235 and found this thread:

http://www.gossamer-threads.com/lists/wiki/mediawiki/617501

Which led to this thread:

https://phabricator.wikimedia.org/T30235

Apparently there was a reported issue with these two lines in the /images/.htaccess file:

#   AddType text/plain .html .htm .shtml .php

#   php_admin_flag engine off

Commented these out and images now render correctly.

103.36.18.9 (talkcontribs)

Thanks man this solution works to me.. -rhalf

Wobuck (talkcontribs)

I am using Mediawiki 1.26.4 with PHP 5.4 I SOLVED the problem by switching on XMLREADER in the php version via cpanel after seeing the error in the error log which is stored in the Mediawiki directory on my website.

Hope this helps !

Reply to "500 Error on Uploaded File"