Media wiki install problem

Discussion in 'PHP' started by alex, Jul 17, 2009.

  1. alex

    alex Well-Known Member

    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';
  2. mistwang

    mistwang LiteSpeed Staff

    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.
  3. alex

    alex Well-Known Member

    My php programmer suggested:

    foreach (apache_request_headers() as $key => $value)
    echo Name: $key / Value: $value<br />


    foreach (litespeed_request_headers() as $key => $value)
    echo Name: '$key' / Value: '$value'<br />

    are both returning blank pages, view source also shows a blank page
  4. mistwang

    mistwang LiteSpeed Staff

    Syntax error in you code, following works for me.

  5. alex

    alex Well-Known Member

  6. mistwang

    mistwang LiteSpeed Staff

    I have no clue either. Maybe you can do some experiment with mediawiki code, like checking the return value with "var_dump".

Share This Page