Page MenuHomePhabricator

"Editor won't start: 500 (Internal Server Error)" due to calling mime_content_type() without fallback to 'fileinfo'
Closed, ResolvedPublic

Event Timeline

Jidanni created this task.Aug 6 2017, 3:27 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 6 2017, 3:27 PM

Odd. It only happens on that production machine. Not my private machine.
So apparently the environment is different.
http://radioscanningtw.jidanni.org/index.php?title=Special:Version&uselang=en
So maybe it is depending on too new php...

Error from line 191 of /home/jidanni/mediawiki/includes/libs/CSSMin.php: Call to undefined function mime_content_type()
[GlobalTitleFail] RequestContext::getTitle called by MWExceptionHandler::report/MWExceptionRenderer::output/MWExceptionRenderer::reportHTML/MWExceptionRenderer::useOutputPage/RequestContext->getTitle with no title set.

https://www.google.com/search?q=php+Call+to+undefined+function+mime_content_type()

Anyway, I'll stick to $wgMFDefaultSkinClass = "SkinVector"; for now.

Error from line 191 of /home/jidanni/mediawiki/includes/libs/CSSMin.php: Call to undefined function mime_content_type()

@Jidanni: http://php.net/manual/en/function.mime-content-type.php does not imply it is deprecated in some PHP version. So to me this sounds a lot like a problem with your setup but not like a problem in MinervaNeue?

Did you correctly update submodules/composer after your deploy?

Never heard of it. All I do is

GC="git clone --progress --depth 1"
RP=https://gerrit.wikimedia.org/r/p/mediawiki
$GC $RP/core.git $PWD
$GC $RP/vendor.git
cd skins
$GC $RP/skins/Vector.git
$GC $RP/skins/MinervaNeue.git
cd ../extensions
$GC $RP/extensions/MobileFrontend.git

every month

Have you got ImageMagik set up correctly?

Is there a script to test if I do or not? I just use Dreamhost's.

Why isn't Imagemagick listed on
http://radioscanningtw.jidanni.org/index.php?title=Special:Version&uselang=en ?

I'm not too familiar with your install process but it wouldn't hurt to try the following:

cd $RP
composer install
php maintenance/update.php

(Instructions on how to get https://www.mediawiki.org/wiki/Composer)

/usr/local/bin/php-7.0 --info says

imagick

imagick module => enabled
imagick module version => 3.4.3RC1
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
Imagick compiled with ImageMagick version => ImageMagick 6.7.7-10 2017-07-15 Q16 http://www.imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.7.7-10 2017-07-15 Q16 http://www.imagemagick.org
ImageMagick copyright => Copyright (C) 1999-2012 ImageMagick Studio LLC
ImageMagick release date => 2017-07-15
ImageMagick number of supported formats: => 210
ImageMagick supported formats => 3FR, A, AAI, AI, ART, ARW, AVI, AVS, B, BGR, BGRA, BMP, BMP2, BMP3, BRF, C, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FITS, FRACTAL, FTS, G, G3, GIF, GIF87, GRADIENT, GRAY, GROUP4, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, J2C, J2K, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, M4V, MAC, MAP, MAT, MATTE, MEF, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YCbCr, YCbCrA, YUV

Directive => Local Value => Master Value
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.skip_version_check => 0 => 0

@Aklapper tell me if you need any php --info output.

Tell me if you need an account.

Jdlrobson updated the task description. (Show Details)Aug 8 2017, 7:25 PM

@jidanna can you please inspect your mediawiki logs?

Somewhere the error message that's caused when I visit http://radioscanningtw.jidanni.org/load.php?debug=false&lang=en&modules=oojs-ui%2Coojs-ui-core%2Coojs-ui-toolbars%2Coojs-ui-widgets%2Coojs-ui-windows%7Coojs-ui-core.styles%7Coojs-ui.styles.icons-alerts%2Cicons-content%2Cicons-editing-advanced%2Cicons-editing-core%2Cicons-interactions%2Cicons-moderation%2Cicons-movement%2Cindicators%2Ctextures&skin=minerva&version=11m6dtw is captured and that will shed light on what's happening here.

Without that information we're not going to be able to get to the bottom of this.

https://www.mediawiki.org/wiki/Manual:How_to_debug should help explain how to get that information if it's not clear.

You mentioned (?) composer. Well that looks like it is for installing PHP stuff, but that is the job of the hosting company (Dreamhost) and I don't want to mess with their fragile environment.

$ ls -l /usr/local/bin/php*
lrwxrwxrwx 1 root root 16 2015-02-08  /usr/local/bin/php-5.3 -> ../php53/bin/php
lrwxrwxrwx 1 root root 16 2016-02-12  /usr/local/bin/php-5.4 -> ../php54/bin/php
lrwxrwxrwx 1 root root 16 2016-08-04  /usr/local/bin/php-5.5 -> ../php55/bin/php
lrwxrwxrwx 1 root root 16 07-27 09:28 /usr/local/bin/php-5.6 -> ../php56/bin/php
lrwxrwxrwx 1 root root 16 07-27 10:13 /usr/local/bin/php-7.0 -> ../php70/bin/php
lrwxrwxrwx 1 root root 16 07-27 10:28 /usr/local/bin/php-7.1 -> ../php71/bin/php
lrwxrwxrwx 1 root root 19 2015-02-08  /usr/local/bin/phpize-5.3 -> ../php53/bin/phpize
lrwxrwxrwx 1 root root 19 2016-02-12  /usr/local/bin/phpize-5.4 -> ../php54/bin/phpize
lrwxrwxrwx 1 root root 19 2016-08-04  /usr/local/bin/phpize-5.5 -> ../php55/bin/phpize
lrwxrwxrwx 1 root root 19 07-27 09:28 /usr/local/bin/phpize-5.6 -> ../php56/bin/phpize
lrwxrwxrwx 1 root root 19 07-27 10:13 /usr/local/bin/phpize-7.0 -> ../php70/bin/phpize
lrwxrwxrwx 1 root root 19 07-27 10:28 /usr/local/bin/phpize-7.1 -> ../php71/bin/phpize

matmarex removed a project: OOUI.EditedAug 9 2017, 6:46 PM
matmarex added subscribers: Krinkle, Legoktm, matmarex.

Error from line 191 of /home/jidanni/mediawiki/includes/libs/CSSMin.php: Call to undefined function mime_content_type()

@Jidanni: http://php.net/manual/en/function.mime-content-type.php does not imply it is deprecated in some PHP version. So to me this sounds a lot like a problem with your setup but not like a problem in MinervaNeue?

Note that this is under the "Fileinfo" extension section. Perhaps you managed to disable it somehow. I didn't even know that it's possible.

If this PHP feature can indeed be disabled, we should probably document that we rely on it, and immediately refuse to run if it's missing (like we do e.g. for mbstring providing multibyte string functions, in the PHPVersionCheck class).

See also rMW7f000f86812f: Re-introduce use of mime_content_type().

(Definitely not an OOjs UI issue.)

Change 370867 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/core@master] PHPVersionCheck: Add 'fileinfo' extension

https://gerrit.wikimedia.org/r/370867

I updated all Mediawiki parts via git.
I enabled php7.1 on my webhost.
Still the editor does not start.
I am sorry but I am forced to use
$wgSkipSkins = array( "MinervaNeue" );
$wgMFDefaultSkinClass = "SkinVector";

@Jidanni does applying the patch above (https://gerrit.wikimedia.org/r/#/c/370867/) make any difference?

All I know is before you split MinervaNeue out of MobileFrontend, mobile users could use it fine. I have one person who regularly edits via cellphone.
Now I have to force him to use Vector on his cellphone.

OK I will try to apply the patch.

jidanni@beulah:~/mediawiki/includes$ base64 -d /tmp/b464034.diff.base64 | patch
patching file PHPVersionCheck.php

and................ sorry. No improvement. As you can click and see.

And I'm sorry I had to revert your patch off of my system, as it brought my site to a screeching halt. Sorry I didn't take a screenshot, as I had to do it fast. Something about failing that test.

Change 370867 merged by jenkins-bot:
[mediawiki/core@master] PHPVersionCheck: Add 'fileinfo' extension

https://gerrit.wikimedia.org/r/370867

Yes, that's what that patch is supposed to do. This means you're missing the 'fileinfo' PHP extension – you somehow disabled it. MediaWiki requires it for correct operation. (Sorry, this was previously not properly documented – no one noticed, so apparently most normal installations include it.) Please get it enabled and see if that helps.

jidanni@beulah:~$ php -r 'print mime_content_type("/dev/null");'

Fatal error: Call to undefined function mime_content_type() in Command line code on line 1

OK I suppose I should warn Dreamhost that all the Mediawikis running on
their servers will stop working soon unless they install that function.

If this turns out to be a widespread issue, it is probably possible to implement a workaround, but for now yours is the only report of this problem.

Jdlrobson closed this task as Resolved.Aug 10 2017, 6:05 PM
Jdlrobson claimed this task.

And I'm sorry I had to revert your patch off of my system, as it brought my site to a screeching halt.

Yup, it will do that if your setup doesn't meet the php requirements.

If you can't get that installed right now (i.e. blocked on dreamhost) it might be advisable to roll back to the last MediaWiki version for the time being.

OK now this is working. Thanks.

Alas my other php issue didn't get fixed by this,
https://phabricator.wikimedia.org/T172599

Aklapper renamed this task from Editor won't start: 500 (Internal Server Error) to "Editor won't start: 500 (Internal Server Error)" due to calling mime_content_type() without fallback to 'fileinfo'.Aug 11 2017, 9:05 AM