How To Fixed Invalid Argument Error When Installing MediaWiki
I just tried to install fresh MediaWiki and found this error when i finished installing MediaWiki.
Here is the error when we hit http://yourwiki.com
You can see the error for the first line in your wiki
[code]Warning: Invalid argument supplied for foreach() in /usr/home/wowwiki/public_html/includes/Setup.php on line 154[/code]
To Fixed/Removed this line, we can just simple edit the setup.php script on the line 154
First, login into your wiki server
edit the setup.php with your favorite editor such as nano,vi, etc.
[code]$vi /usr/home/wowwiki/public_html/includes/Setup.php[/code]
[code]### Find line 154 like below
Useful debug output
if ( $wgCommandLineMode ) {
wfDebug( "\n\nStart command line script $self\n" );
} elseif ( function_exists( 'getallheaders' ) ) {
wfDebug( "\n\nStart request\n" );
wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "$
$headers = getallheaders();
foreach ($headers as $name => $value) {
wfDebug( "$name: $value\n" );
}
wfDebug( "\n" );
} elseif( isset( $_SERVER['REQUEST_URI'] ) ) {
wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "$
}[/code]
Added comment (#) to the whole script like below
[code]# Useful debug output
# if ( $wgCommandLineMode ) {
# wfDebug( "\n\nStart command line script $self\n" );
# } elseif ( function_exists( 'getallheaders' ) ) {
# wfDebug( "\n\nStart request\n" );
# wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "$
# $headers = getallheaders();
# foreach ($headers as $name => $value) {
# wfDebug( "$name: $value\n" );
# }
# wfDebug( "\n" );
# } elseif( isset( $_SERVER['REQUEST_URI'] ) ) {
# wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "$
# }[/code]
Save and exit this file.
Try to hit your wiki from firefox/IE the first line error will gone and you can see your wiki first page without any error line.
This error is because your PHP isn't set up as an Apache module, getallheaders() may not be available. You don't actually need it though, it's just a debugging aid.
Recent blog posts |
Recent comments
|
Comments
Post new comment