Media Wiki Troubleshooting: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 3: Line 3:


=Internal=
=Internal=
* [[Media_Wiki_Operations#Troubleshooting|Media Wiki Operations]]


* [[Media Wiki#Subjects|Media Wiki]]
=Debugging=
==PHP Info==
Add a file called <code>info.php</code> in <code>/var/www/mediawiki-*</code>, with the following content, and serve it through the web server:
 
<pre>
<?php phpinfo() ?>
</pre>


=Debugging=
==PHP Errors==
==PHP Errors==


Add the following to the second line from the top (right below the <?php) of [[Media_Wiki_Concepts#LocalSettings.php|LocalSettings.php]]:
Add the following to the second line from the top (right below the <?php) of <code>[[Media_Wiki_Concepts#LocalSettings.php|LocalSettings.php]]</code>:


<syntaxhighlight lang='php'>
<syntaxhighlight lang='php'>
Line 22: Line 28:
This will configure MediaWiki to show the errors in page.
This will configure MediaWiki to show the errors in page.


Also add in [[Media_Wiki_Concepts#index.php|index.php]]:
Also add in <code>[[Media_Wiki_Concepts#index.php|index.php]]</code>:
<syntaxhighlight lang='php'>
<syntaxhighlight lang='php'>
error_reporting( -1 );
error_reporting( -1 );
Line 37: Line 43:
</syntaxhighlight>
</syntaxhighlight>


=PHP Info=
=Log Locations=
=Common Errors=
==Fails to upload images with 'Fatal exception of type "MWException"'==
Apache error log shows:
<font size=-2>
[...] PHP Warning:  failed to mkdir "/var/www/mediawiki-1.26.2/images/lockdir" mode 0777 [...]
</font>
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 &#124; Enable File Uploads]].


Add a file called <tt>info.php</tt> in <tt>/var/www/mediawiki-*</tt>, with the following content, and serve it through the web server:
For more details, see [[Selinux#Permission_Denied_when_Trying_to_Write_in_a_Directory|selinux &#124; Permission Denied when Trying to Write in a Directory]]


<pre>
==Fails to upload images with "Could not open lock file for "mwstore://local-backend/local-public/..." message in console==
<?php phpinfo() ?>
<font size=-2>
</pre>
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&#58;//www.mediawiki.org/wiki/Special:MyLanguage/Manual:$wgUploadDirectory for more information.
</font>
SELinux issue, it happened because the <code>images</code> directory did not have the <code>httpd_user_rw_content_t</code> SELinux context type.


=Log Locations=
==The Header and Footer Contain Deprecation Warnings==
Example:
<font size=-2>
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
</font>
Configure PHP production error reporting, as shown here: {{Internal|PHP#Error_Reporting|PHP Error Reporting}}

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.

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