LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > Media wiki install problem

Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2009, 09:08 PM
alex alex is offline
Senior Member
 
Join Date: Jan 2006
Posts: 51
Default Media wiki install problem

I am trying to install mediawiki on a lites speed web server. It goes along well then I get the error:
Warning: Invalid argument supplied for foreach() in /usr/local/lsws/wiki/htdocs/w/includes/ProxyTools.php on line 17

Line 17 of ProxyTools.php is the one that starts with the foreach, I'm wondering if the apache_request_headers is causing the issue

function wfGetForwardedFor() {
if( function_exists( 'apache_request_headers' ) ) {
// More reliable than $_SERVER due to case and -/_ folding
$set = array ();
foreach ( apache_request_headers() as $tempName => $tempValue ) {
$set[ strtoupper( $tempName ) ] = $tempValue;
}
$index = strtoupper ( 'X-Forwarded-For' );
$index2 = strtoupper ( 'Client-ip' );
} else {
// Subject to spoofing with headers like X_Forwarded_For
$set = $_SERVER;
$index = 'HTTP_X_FORWARDED_FOR';
$index2 = 'CLIENT-IP';
Reply With Quote
  #2  
Old 07-18-2009, 07:35 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
can you write a small test PHP script to verify this.
apache_request_headers() is a function alias of litespeed_request_headers(). it should work.
Reply With Quote
  #3  
Old 07-20-2009, 07:09 PM
alex alex is offline
Senior Member
 
Join Date: Jan 2006
Posts: 51
George,
My php programmer suggested:

<?php
foreach (apache_request_headers() as $key => $value)
{
echo Name: $key / Value: $value<br />
}
exit;

and

<?php
foreach (litespeed_request_headers() as $key => $value)
{
echo Name: '$key' / Value: '$value'<br />
}
exit;

are both returning blank pages, view source also shows a blank page
Reply With Quote
  #4  
Old 07-20-2009, 07:23 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Syntax error in you code, following works for me.

Quote:
<?php
$header=apache_request_headers();
var_dump($header);
foreach ($header as $key => $value)
{
echo "Name: $key / Value: $value <br />";
}
exit;
Reply With Quote
  #5  
Old 07-20-2009, 07:32 PM
alex alex is offline
Senior Member
 
Join Date: Jan 2006
Posts: 51
That worked for me too
http://wiki.wdwinfo.com/w/test4.php
So the question is why does the mediawiki installer think it's not working
Reply With Quote
  #6  
Old 07-20-2009, 08:15 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
I have no clue either. Maybe you can do some experiment with mediawiki code, like checking the return value with "var_dump".
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:22 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.