Welcome to Geeklog, Anonymous Tuesday, April 23 2024 @ 06:00 pm EDT

Geeklog Forums

Parse error, unexpected $ in ./lib-common.php at line 4026


Status: offline

csmart

Forum User
Newbie
Registered: 04/07/05
Posts: 1
Location:The Frozen North
Just getting my first geeklog site up and running, and I encountered the following error:

Parse error, unexpected $ in /home/.../lib-common.php at line 4026

The offending code from the lib-common.php included with 1.3.11 was

Text Formatted Code

if( $fp = @fopen( $rdfurl, 'r' ))
    {
        $startoffeed = true;
        while( $data = fread( $fp, 4096 ))
        {
            if( $startoffeed )
            {
                $data = ltrim( $data );
                if( empty( $data ))
                {
                    break;
                }
                $startoffeed = false;
            }
            if( !xml_parse( $xml_parser, $data, feof( $fp )))
            {
                $errmsg = sprintf(
                    'Parse error in %s: %s at line %d',
                    $rdfurl,
                    xml_error_string( xml_get_error_code( $xml_parser )),
                    xml_get_current_line_number( $xml_parser )
                    );

                COM_errorLog( $errmsg, 1 );
                $rdferror = true;
                $result = DB_change( $_TABLES['blocks'], 'content',
                                     addslashes( $LANG21[4] ), 'bid', $bid );
                break;
            }
        }
        if( $startoffeed && empty( $data ))
        {
            $errmsg = sprintf( 'The feed at %s exists but is currently empty.',
                               $rdfurl );
            COM_errorLog( $errmsg, 1 );
            $rdferror = true;
            $result = DB_change( $_TABLES['blocks'], 'content',
                                 addslashes( $LANG21[4] ), 'bid', $bid );
        }

        fclose( $fp );
        xml_parser_free( $xml_parser );

        if( !$rdferror )
        {
            if( $maxheadlines > 0 )
            {
                $RDFheadlines = array_slice( $RDFheadlines, 0, $maxheadlines );
            }
            $blockcontent = COM_makeList( $RDFheadlines, 'list-feed' );
            $RDFheadlines = array();
            $blockcontent = preg_replace( "/(1512)|(15)|(12)/", '',
                                          $blockcontent );
            $result = DB_change( $_TABLES['blocks'], 'content', $blockcontent,
                                 'bid', $bid);
        }
    }
    else
    {
        $errmsg = sprintf( 'Geeklog can not reach the feed at %s.', $rdfurl );

        if( !@ini_get( 'allow_url_fopen' ))
        {
            $errmsg = 'Sorry, your webserver configuration does not allow reading of remote files (allow_url_fopen = off).';
        }

        COM_errorLog( $errmsg, 1 );
        $rdferror = true;

        $result = DB_change( $_TABLES['blocks'], 'content',
                             addslashes( $LANG21[4] ), 'bid', $bid );
    }

 


Line 4026 is the IF() statement nested in the last ELSE clause...

Text Formatted Code

if( !@ini_get( 'allow_url_fopen' ))

 


I've found two solutions... For a real kludge fix, I simply commented out that final IF() statement. However, after consulting with a friend, he suggested I try adding:

Text Formatted Code

php_value register_globals 1
php_value allow_url_fopen 1

 


to .htaccess in my public_html directory, in order to reenable those features. (Apparently my hosting provider does not enable these by default.) Seems to have done the trick, as I've uncommented the code and the site appears to be running...

Just thought I'd pass along my findings in case it might help someone else.

Cheers!
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
A parse error is a syntax error in a .php file (missing or wrong characters, for example). It won't go away by allowing url_fopen or switching on register_globals ...

You must have done something else besides that.

bye, Dirk
 Quote

All times are EDT. The time is now 06:00 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content