Page MenuHomePhabricator

Show a helpful error message if an installer dependency is missing
Closed, ResolvedPublic

Description

(From bug 47356 comment #6)

It would be nice to have a checker which checks all required
packages/extensions/functions. This checker should run on installation and on
the fatal error exception error page.

If a PHP extension such as XML or JSON is missing, the web installer will
fail with a PHP Fatal error even before the current environmental checks
happen. This isn't very user-friendly.

Perhaps the web installer could check for extensions that MediaWiki
unconditionally requires, and show an ugly, non-localized (yet useful)
error page if an extension is missing. Command-line scripts could also
make the same checks.

Perhaps the web installer checks could just run as part of the request
startup or shutdown sequence, even if only when a fatal error or
uncaught exception occurs.

http://stackoverflow.com/questions/277224/how-do-i-catch-a-php-fatal-error


Version: 1.22.0
Severity: enhancement
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=42205
https://bugzilla.wikimedia.org/show_bug.cgi?id=45822
https://bugzilla.wikimedia.org/show_bug.cgi?id=54774

Details

Reference
bz47564

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:30 AM
bzimport set Reference to bz47564.
bzimport added a subscriber: Unknown Object (MLST).

Perhaps XML and JSON aren't very good examples, as work is in progress to
kill those dependencies. However, there are some others:

  • Ctype
  • Hash (if mcrypt, openssl, /dev/urandom all unusable)
  • Session

Ctype might be trivial to implement using strspn or preg_match, though
the others are less trivial.

In practice, this depends on bug 45822 doesn't it? Or how will the installer know what extensions are needed? Oh, you propose an after the fact solution; so is it alternative to bug 45822?

(In reply to comment #2)

In practice, this depends on bug 45822 doesn't it? Or how will the installer
know what extensions are needed? Oh, you propose an after the fact solution;
so
is it alternative to bug 45822?

No, this is completely different.

Bug 45822 is for expanding the list of suggested PHP extensions in composer.json, a file used by the Composer[1] dependency manager. This bug is for fixing the MediaWiki installer, which currently uses neither Composer nor its associated configuration files.

[1]: http://getcomposer.org/

Hardcoded checks for certain PHP extensions currently exist in includes/installer/Installer.php. Because certain portions of MediaWiki depend on some of these extensions (and the installer reuses those portions), before the user even gets to select his or her language, a PHP fatal error occurs. If display_errors is off, the user will see not an error message but a blank page.

The most common case occurs when the DOMDocument class, which LocalisationCache::loadPluralFile() uses to load the CLDR plural rules, is missing. This is because Linux distributors such as Red Hat tend to package the DOM extension separately from the PHP binary itself.

The unmerged patch for bug 42205 would add a file containing the same information in PHP serialize() format, which would be readable regardless of the installed set of PHP extensions. This would remove the installer's dependency on the DOM extension. Removing the installer's dependency on the XML extension would be trivial, simply by skipping envCheckBrokenXML when the XML extension is missing.

However, it would still be possible for someone who has compiled PHP himself (e.g. with ./configure --disable-all) to be missing the session extension. It would be nice to show an error message even in those cases.

Apparently, missing ctype_* functions currently aren't a problem, though a check for hash() ought to be added to the installer.

(In reply to comment #3)

(In reply to comment #2)

In practice, this depends on bug 45822 doesn't it? Or how will the installer
know what extensions are needed? Oh, you propose an after the fact solution;
so
is it alternative to bug 45822?

No, this is completely different.

Bug 45822 is for expanding the list of suggested PHP extensions in
composer.json, a file used by the Composer[1] dependency manager. This bug is
for fixing the MediaWiki installer, which currently uses neither Composer nor
its associated configuration files.

[1]: http://getcomposer.org/

I know it's not currently used, but that bug seems to be asking to expand its usage to fix problems like these. Of course I have no idea what the way forward is. :)