Media Wiki Troubleshooting

From NovaOrdis Knowledge Base
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

Internal

Debugging

PHP Info

Add a file called info.php in /var/www/mediawiki-*, with the following content, and serve it through the web server:

<?php phpinfo() ?>

PHP Errors

Add the following to the second line from the top (right below the <?php) of LocalSettings.php:

error_reporting( -1 );
ini_set( 'display_errors', 1 );
$wgDebugToolbar = true;
$wgShowExceptionDetails = true;
$wgDevelopmentWarnings = true;
$wgShowDebug = true;

This will configure MediaWiki to show the errors in page.

Also add in index.php:

error_reporting( -1 );
ini_set( 'display_startup_errors', 1 );
ini_set( 'display_errors', 1 );

SQL Errors

Add in LocalSettings.php:

$wgShowSQLErrors = true;
$wgDebugDumpSql  = true;

Log Locations

Common Errors

Fails to upload images with 'Fatal exception of type "MWException"'

Apache error log shows:

[...] PHP Warning:  failed to mkdir "/var/www/mediawiki-1.26.2/images/lockdir" mode 0777 [...]

This is caused by selinux preventing write on the images directory /var/www/mediawiki/images. Fix: Media Wiki Installation | Enable File Uploads.

For more details, see selinux | Permission Denied when Trying to Write in a Directory

Fails to upload images with "Could not open lock file for "mwstore://local-backend/local-public/..." message in console

Could not open lock file for "mwstore://local-backend/local-public/3/37/Something.png". Make sure your upload directory is configured correctly and your web server has permission to write to that directory. See https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:$wgUploadDirectory for more information.

SELinux issue, it happened because the images directory did not have the httpd_user_rw_content_t SELinux context type.

The Header and Footer Contain Deprecation Warnings

Example:

Deprecated: Return type of RemexHtml\Tokenizer\PlainAttributes::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute  should be used to temporarily suppress the notice in /opt/brew/var/www/mediawiki-1.35.14/vendor/wikimedia/remex-html/RemexHtml/Tokenizer/PlainAttributes.php on line 32

Configure PHP production error reporting, as shown here:

PHP Error Reporting