Media Wiki Troubleshooting: Difference between revisions
Line 52: | Line 52: | ||
This is caused by [[selinux]] preventing write on the images directory <code>/var/www/mediawiki/images</code>. Fix: [[Media_Wiki_Installation#Enable_File_Uploads|Media Wiki Installation | Enable File Uploads]]. | This is caused by [[selinux]] preventing write on the images directory <code>/var/www/mediawiki/images</code>. Fix: [[Media_Wiki_Installation#Enable_File_Uploads|Media Wiki Installation | Enable File Uploads]]. | ||
For more details, see [[ | For more details, see [[Selinux#Permission_Denied_when_Trying_to_Write_in_a_Directory|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== | ==Fails to upload images with "Could not open lock file for "mwstore://local-backend/local-public/..." message in console== | ||
<font size=-2> | <font size=-2> |
Latest revision as of 19:52, 30 December 2023
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.
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: