Topic on Project:Support desk

500 error when uploading/viewing images

6
Ebmarquez (talkcontribs)

I recently install mediawiki and have not had any issues creating and editing wiki pages until I attempted to upload a new image to the wiki server. I used the upload file page, after I browsed to my 60k image I selected upload file. After that I received a 500 error. I also get this on any page that attempt to view the image. Gallery of new files, File lists.. etc.

Error:

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

I've check my permission on the following files to try and fix the issue.

C:\php\ IUSR Permission Full Control
C:\inetpub\wwwroot\wiki\images IUSR Permission Full Control

I can also see the image in C:\inetpub\wwwroot\wiki\images\e\e5 Any ideas of how to fix this issue.

System Information:

MediaWiki: 1.19.2
PHP Version: 5.4.6
MySQL: 5.5.27
OS: Windows Server 2012 Enterprise
Web Server: IIS 8

LocalSettings.php

$wgUseImageMagick = true;
$wgImageMagickConvertCommand = 'C:\Program Files (x86)\ImageMagick-6.7.9-Q16\convert.exe';
$wgEnableUploads = true;
$wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg', 'doc', 'xls', 'mpp', 'pdf', 'ppt', 'tiff', 'bmp', 'docx', 'xlsx', 'pptx', 'ps');
$wgMimeDetectorCommand = "file -bi";
$wgHashedUploadDirectory = false;
$wgCacheDirectory = "$IP/cache";  
Ebmarquez (talkcontribs)

I also created an error log by adding show exceptions and debuglogfile option.

$wgShowExceptionDetails = true;
$wgDebugLogFile = 'C:\inetpub\wwwroot\wiki\error-debug_log.txt';

I'm not seeing a smoking gun in the log, so would this mean a permission issue?

Here's the log output from when I tried to upload a new image.

Start request

POST /wiki/index.php?title=Special:Upload
HTTP HEADERS:
CONTENT-TYPE: multipart/form-data; boundary=---------------------------7dc8b2a70ed0
CONTENT-LENGTH: 73599
DNT: 1
USER-AGENT: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/6.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Zune 4.7)
REFERER: http://myhost/wiki/index.php?title=Special:Upload
HOST: myhost
COOKIE: mywikiUserID=2; mywikiUserName=ebm; mywikiToken=6dc05764f1653a44f083e819d21ade4c;  mywiki_session=c6b16529aa3a5585d958146bb2bc1550
ACCEPT-LANGUAGE: en-US,en;q=0.8,ja;q=0.7,ko;q=0.5,zh-Hant;q=0.3,zh-Hans;q=0.2
ACCEPT-ENCODING: gzip, deflate
ACCEPT: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, */*
CONNECTION: Keep-Alive
CACHE-CONTROL: no-cache

CACHES: EmptyBagOStuff[main] SqlBagOStuff[message] SqlBagOStuff[parser]
session_set_cookie_params: "0", "/", "", "", "1"
LocalisationCache: using store LCStore_CDB
Warning: no dba extension found, using emulation.
User: cache miss for user 2
Connecting to localhost mywiki...
Profiler::instance called without $wgProfiler['class'] set, falling back to ProfilerStub for safety
Connected to localhost mywiki.
 Connecting to localhost mywiki...
Connected to localhost mywiki.
MessageCache::load: Loading en... got from global cache
Gadget::loadStructuredList: MediaWiki:Gadgets-definition parsed, cache entry mywiki:gadgets-definition:6 updated
User: loading options for user 2 from database.
User: logged in from session
Fully initialised
User: cache miss for user 2
User: loading options for user 2 from database.
User: logged in from session
User: loading options for user 2 from override cache.
Unstubbing $wgParser on call of $wgParser::firstCallInit from unknown
Parser: using preprocessor: Preprocessor_DOM
Unstubbing $wgLang on call of $wgLang::_unstub from unknown
User::getBlockedStatus: checking...
UploadBase::createFromRequest: class name: UploadFromFile
FSFile::getProps: Getting file info for C:\php\uploadtemp\phpD270.tmp
MimeMagic::__construct: loading mime types from C:\inetpub\wwwroot\wiki/includes/mime.types
MimeMagic::__construct: loading mime info from C:\inetpub\wwwroot\wiki/includes/mime.info
MimeMagic::doGuessMimeType: analyzing head and tail of C:\php\uploadtemp\phpD270.tmp for  magic numbers.
MimeMagic::doGuessMimeType: getimagesize detected C:\php\uploadtemp\phpD270.tmp as image/jpeg
MimeMagic::guessMimeType: guessed mime type of C:\php\uploadtemp\phpD270.tmp: image/jpeg
MimeMagic::improveTypeFromExtension: improved mime type for .jpg: image/jpeg
XMPReader::startElementModeInitial Ignoring unrecognized element <http://ns.microsoft.com/photo/1.2/:RegionInfo>.
XMPReader::startElementModeInitial Ignoring unrecognized element  <http://ns.microsoft.com/photo/1.2/:RegionInfo>.
FSFile::getProps: C:\php\uploadtemp\phpD270.tmp loaded, 72611 bytes, image/jpeg.


mime: <image/jpeg> extension: <jpg>

UploadBase::verifyExtension: mime type image/jpeg matches extension jpg, passing file
UploadBase::detectScript: checking for embedded scripts and HTML stuff
UploadBase::detectScript: no scripts found
ZipDirectoryReader: Fatal error: zip file lacks EOCDR signature. It probably isn't a zip file.
UploadBase::detectVirus: virus scanner disabled
UploadBase::verifyFile: all clear; passing.
ForeignAPIRepo: HTTP GET: http://commons.wikimedia.org/w/api.php?titles=File%3 ATestebm.jpg&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7 Cmime&prop=imageinfo&iimetadataversion=2&format=json&action=query&redirects=true
Class PEAR_Error not found; skipped loading
ForeignAPIRepo: HTTP GET: http://commons.wikimedia.org/w/api.php?aisha1base36=cupt8rlsj0ezk8 grtpenzmfhxwsire3&aiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7 Cmime&list=allimages&format=json&action=query&redirects=true
FSFileBackend::getFileListInternal() given directory does not  exist: 'C:\inetpub\wwwroot\wiki/images/thumb/Testebm.jpg'
LocalFile::purgeThumbList: array ()
DatabaseBase::query: Writes done: INSERT IGNORE INTO `image`  (img_name,img_size,img_width,img_height,img_bits,img_media_type,img_major_mime,img_minor_mime,img_timestamp,img_description,img_user,img_user_text,img_metadata,img_sha1) VALUES ('Testebm.jpg','72611','720','480','8','BITMAP','image','jpeg','20120927234345','test','2','Redmond\\emarq','a:2:{s:8:\"Software\";s:50:\"Microsoft Windows Live Photo Gallery 15.4.3555.308\";s:22:\"MEDIAWIKI_EXIF_VERSION\";i:2;}','cupt8rlsj0ezk8grtpenzmfhxwsire3')
IP: 172.19.41.60
WikiPage::doEditUpdates: No vary-revision, using prepared edit...
Saved in parser cache with key mywiki:pcache:idhash:37-0!*!*!*!*!*!* and timestamp  20120927234345
DatabaseBase::query: Writes done: REPLACE INTO `objectcache` (keyname,value,exptime) VALUES  ('mywiki:pcache:idhash:37-0!*!*!*!*!*!*','uTÛnâ0 ís¾ÂÍãJ”\\ l\rª´BÝ ‰K$Ðî³Ifƒ—Ķl§@«þûzÂ¥¶ð€tÎØsæÌ1s\ZFÔO˜6 ç•U•õi ÑWC»Ô/—°³~ßÐ8èQ  - ë\rÚêÑ Ü¶ZÄ›Á6IHÁKn‰ %µõ ÷«e\nÆHM„Ì€¤² –’°  õÇK¤±-Ø)&2ÂEZT®Èð  $hGÁC/ìFdµw½¼%”ª`  ÓyU‚°_Ô=í  ÃŸ¨z ò· ©åRœš ØÜkµ ½ƒò { l~ªOYº ²åvM6°\'\0é–o8U5Ny¶ffMã^+¸ýöþ%8€å¥3…•ŠDAèTE½(îĝ.Áfè]ØqFN˜È+–Ä‹ñûŒ ôõÍq¡ã†nÀ\\j M\"@÷¹-à´‚ðžú?y téÚÁª¼û§rÄïñö«[ëÃGëšxÔÀÇYƒqÛ-Ç¥Ó׬þî@ì¸\0¦Óõ\\¡ŸM çzÚYЂ ×\n0<cá8´ñ³¡]r P¯Èï¯hÐ?ž ñ >¡p ™üÅŠ ôþ   ËÆ ÊÆý¨{*³ª€kµ t‘j®l“‹ß9»¿<Ö=SS é+‡ÐÏã IÙ ñÁ ˜ \\äWèq²kŸŸ2nÔRn\0ù \rûG³ - h{‘ <µœ GËé cà¼ðûçÜ #yŠße2 \\lnš¯þÆ­+ƒ]\" žî  ÆÁ‡Â )¾nÈ>$ %ý mêÍÕ áÝý]ç¬kˆ	Å}­«¶´®sOšã®gˆb>‡RXÆ…™ Ù”å<=Äàí?','20120928234345')
BacklinkCache::getLinks: from DB
BacklinkCache::partition: got from database
BacklinkCache::getLinks: from DB
BacklinkCache::getLinks: from DB
OutputPage::sendCacheControl: private caching;  **
Request ended normally

Start request

GET /wiki/index.php?title=File:Testebm.jpg
HTTP HEADERS:
CONTENT-TYPE: 
CONTENT-LENGTH: 0
DNT: 1
USER-AGENT: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/6.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Zune 4.7)
REFERER: http://myhost/wiki/index.php?title=Special:Upload
HOST: myhost
COOKIE: mywikiUserID=2; mywikiUserName=ebm; mywikiToken=6dc05764f1653a44f083e819d21ade4c;  mywiki_session=c6b16529aa3a5585d958146bb2bc1550
ACCEPT-LANGUAGE: en-US,en;q=0.8,ja;q=0.7,ko;q=0.5,zh-Hant;q=0.3,zh-Hans;q=0.2
ACCEPT-ENCODING: gzip, deflate
ACCEPT: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, */*
CONNECTION: Keep-Alive
CACHE-CONTROL: no-cache

CACHES: EmptyBagOStuff[main] SqlBagOStuff[message] SqlBagOStuff[parser]
session_set_cookie_params: "0", "/", "", "", "1"
LocalisationCache: using store LCStore_CDB
Warning: no dba extension found, using emulation.
User: cache miss for user 2
Connecting to localhost mywiki...
Profiler::instance called without $wgProfiler['class'] set, falling back to ProfilerStub for safety
Connected to localhost mywiki.
Connecting to localhost mywiki...
Connected to localhost mywiki.
MessageCache::load: Loading en... got from global cache
Gadget::loadStructuredList: MediaWiki:Gadgets-definition parsed, cache entry mywiki:gadgets-definition:6 updated
User: loading options for user 2 from database.
User: logged in from session
Fully initialised
User: cache miss for user 2
User: loading options for user 2 from database.
User: logged in from session
User: loading options for user 2 from override cache.
RepoGroup::findFile: got File:Testebm.jpg from process cache
Unstubbing $wgLang on call of $wgLang::getCode from unknown
Unstubbing $wgParser on call of $wgParser::firstCallInit from unknown
Parser: using preprocessor: Preprocessor_DOM
MimeMagic::__construct: loading mime types from C:\inetpub\wwwroot\wiki/includes/mime.types
MimeMagic::__construct: loading mime info from C:\inetpub\wwwroot\wiki/includes/mime.info
File::transform: Doing stat for mwstore://local-backend/local-thumb/Testebm.jpg/720px- Testebm.jpg
RepoGroup::findFile: got File:Testebm.jpg from process cache
Title::getRestrictionTypes: applicable restrictions to [[File:Testebm.jpg]] are  {edit,move,upload}
OutputPage::checkLastModified: client did not send If-Modified-Since header 
Article::view using parser cache: yes
Parser cache options found.
ParserOutput cache found.
Article::view: showing parser cache contents
ContextSource::getContext (ImageHistoryPseudoPager): called and $context is null. Using  RequestContext::getMain() for sanity
File::transform: Doing stat for mwstore://local-backend/local-thumb/Testebm.jpg/120px-Testebm.jpg
ForeignAPIRepo: HTTP GET: http://commons.wikimedia.org/w/api.php?aisha1base36=cupt8rlsj0ezk8grtpenzmfhxwsire3&aiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime&list=allimages&format=json&action=query&redirects=true
Class PEAR_Error not found; skipped loading
Class SkinVector not found; skipped loading
RepoGroup::findFile: got File:Testebm.jpg from process cache
DatabaseBase::query: Writes done: UPDATE  `user` SET user_touched = '20120927234353' WHERE  user_id = '2'
User: cache miss for user 2
User: loading options for user 2 from database.
RepoGroup::findFile: got File:Testebm.jpg from process cache
RepoGroup::findFile: got File:Testebm.jpg from process cache
Title::getRestrictionTypes: applicable restrictions to [[File:Testebm.jpg]] are {edit,move,upload}
User: cache miss for user 2
User: loading options for user 2 from database.
Title::getRestrictionTypes: applicable restrictions to [[File:Testebm.jpg]] are {edit,move,upload}
OutputPage::sendCacheControl: private caching; Thu, 27 Sep 2012 23:43:50 GMT **
Request ended normally
Ebmarquez (talkcontribs)

I was able to figure out what the problem was. The problem in my case was related to how IIS was configured for FastCGI. In the FastCGI settings section of IIS I noticed that the Max Instances was set to 0. I increased the value to 4 and it worked. I'll need to adjust this setting more to find the sweet spot.

134.36.247.45 (talkcontribs)

Hi, I have the same problem.

I uploaded a file and it encountered the 500 - Internal sever problem. I can see the image which is within the link of the file (e.g. /roots/images/3/image.png) However, I cannot view the "File:image.png" and it return 500 - Internal sever problem!

It is very frustrated. Could you please tell me is it similar to your problem?

Thanks,

2602:304:CD8E:FB0:5506:F88F:67A9:FFB1 (talkcontribs)

Make sure you grant Modify rights to the upload folder for the IISUser account.

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 when uploading/viewing images"