Topic on Project:Support desk

[RESOLVED] Failed to open stream: Invalid argument

10
114.31.207.18 (talkcontribs)

PHP: 5.4.16 MediaWiki: 1.22.0 MySQL: 5.6.12

I have just copied MediaWiki to c:\wamp\www\wiki, and run through the configuration\install procedure. I saved LocalSettings.php to c:\wamp\www\wiki.

When I load http://localhost/wiki, I receive the following error:

( ! ) Warning: require_once(C:\wamp\www\wiki�xtensions\InputBox\InputBox.php): failed to open stream: Invalid argument in C:\wamp\www\wiki\LocalSettings.php on line 127

( ! ) Fatal error: require_once(): Failed opening required 'C:\wamp\www\wiki\extensions\InputBox\InputBox.php' (include_path='.;C:\php\pear') in C:\wamp\www\wiki\LocalSettings.php on line 127

The folder C:\wamp\www\wiki\extensions\InputBox exists.

If I enter $MW_INSTALL_PATH = "C:\wamp\www\wiki"; \ in LocalSettings.php, I receive the error:

( ! ) Parse error: syntax error, unexpected 'require_once' (T_REQUIRE_ONCE) in C:\wamp\www\wiki\LocalSettings.php on line 127

88.130.119.179 (talkcontribs)

It's all in the error message: In LocalSettings.php on line 127 you have an error. The path to this extension is somehow wrong. The slash is missing and a "�" also does not belong there.

Make sure to fix the line so that it points to the actual path!

However, the error "unexpected 'require_once'" makes it look like the problem or another problem might also be in one of the lines before line 127. Maybe you have a missing semicolon or so...

114.31.207.18 (talkcontribs)

Line 127 is: require_once "$IP\extensions\InputBox\InputBox.php";

There are no missing semicolons.

88.130.114.181 (talkcontribs)

Or a non-standard whitespace character or something else. I'm not good at guessing without even knowing the code you have there.

Ciencia Al Poder (talkcontribs)

Please post the contents of your LocalSettings.php

The missing semicolon may be on a previous line and not on line 127

114.31.207.18 (talkcontribs)
114.31.207.18 (talkcontribs)
114.31.207.18 (talkcontribs)
Ciencia Al Poder (talkcontribs)

When using Windows path, you should escape backslashes with double backslashes, since the backslash is an escape character and has special meaning inside strings:

require_once("$IP\\extensions\\InputBox\\InputBox.php");
require_once("$IP\\extensions\\Nuke\\Nuke.php");
require_once("$IP\\extensions\\WikiEditor\\WikiEditor.php");
114.31.207.18 (talkcontribs)

Thanks. That fixed it.

You should not have to submit a support ticket for something that could occur for every Windows user.

Reply to "[RESOLVED] Failed to open stream: Invalid argument"