Pergunta

I installed MediaWiki on my localhost (WAMP Server, Windows 7) for the first time and was surprised after a successful installation to get PHP Error Messages regarding extensions I enabled during installation when I loaded index.php for the first time.

Below are 1) the error messages produced, 2) the problem as I see it, 3) a solution to the problem, and finally 4) my question repeated in context with additional follow up questions.

1) The error message:

( ! ) Warning: require_once(C:\wamp\www\wikitest\wxtensions\ConfirmEdit\ConfirmEdit.php): failed to open stream: Invalid argument in C:\wamp\www\wikitest\w\LocalSettings.php on line 128
Call Stack
#   Time    Memory  Function    Location
1   0.0017  251048  {main}( )   ..\index.php:0
2   0.0033  274688  require( 'C:\wamp\www\wikitest\w\includes\WebStart.php' )   ..\index.php:46
3   0.0446  1472088 require_once( 'C:\wamp\www\wikitest\w\LocalSettings.php' )  ..\WebStart.php:136

( ! ) Fatal error: require_once(): Failed opening required 'C:\wamp\www\wikitest\wxtensions\ConfirmEdit\ConfirmEdit.php' (include_path='.;C:\php\pear') in C:\wamp\www\wikitest\w\LocalSettings.php on line 128
Call Stack
#   Time    Memory  Function    Location
1   0.0017  251048  {main}( )   ..\index.php:0
2   0.0033  274688  require( 'C:\wamp\www\wikitest\w\includes\WebStart.php' )   ..\index.php:46
3   0.0446  1472088 require_once( 'C:\wamp\www\wikitest\w\LocalSettings.php' )  ..\WebStart.php:136

2) The problem as I see it

On line 128 of LocalSettings.php (a file generated by the MediaWiki installer) the enabled extensions (optional selections during installation) are included here with backslashes '\' in the paths instead of the expected [forward] slashes '/' used in all other paths in the installed PHP files.

require_once "$IP\extensions\ConfirmEdit\ConfirmEdit.php";
require_once "$IP\extensions\WikiEditor\WikiEditor.php";

3) A solution to the problem

I found that replacing the backslashes with [forward] slashes resolved the error and allowed the index.php page to load as expected.

require_once "$IP/extensions/ConfirmEdit/ConfirmEdit.php";
require_once "$IP/extensions/WikiEditor/WikiEditor.php";

4) Why backslashes in the first place?

Why does the MediaWiki installer use the backslashes in paths only in this instance?

Has anyone else seen this problem?

Can I do anything to prevent it from happening in future installations (to avoid having to manually change the paths each time)?

Foi útil?

Solução

This was a bug in Mediawiki 1.22.0 and has been fixed in 1.22.1. As also mentioned by PleaseStand, here is the bug report.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top