coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Installation & Setup => Topic started by: seven years on July 19, 2004, 12:29:04 AM

Title: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRI
Post by: seven years on July 19, 2004, 12:29:04 AM
I have read the installation documentation and have chmoded the appropriate files.  Yet when I go to the link http://pure-colors.x8r.com/photo/install.php, I get the error:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/pureco01/public_html/photo/install.php on line 412


How can I fix this?
Title: Re: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_
Post by: kegobeer on July 19, 2004, 01:50:56 AM
Sounds like your files may be corrupted.  Try downloading 1.3.1 from this site and uploading again.
Title: Re: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_
Post by: seven years on July 19, 2004, 02:36:13 AM
Nope.  I downloaded it again from a different mirror and still got the same error message.  Could it be the version?  Should I try an earlier version of it?
Title: Re: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_
Post by: kegobeer on July 19, 2004, 03:03:49 AM
Have you edited any of the files prior to upload?  Is your FTP program uploading the files correctly (php/html as ascii, images as binary)?
Title: Re: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_
Post by: seven years on July 19, 2004, 03:43:04 AM
Nope, I haven't edited any files.  I only changed the file permssions as the instructions told me to. And yea, I'm pretty sure that my ftp client is uploading the files correctly; I'm using Fetch.
Title: Re: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_
Post by: kegobeer on July 19, 2004, 05:40:38 AM
Hmm.  I think the problem is actually in init.inc.php, line 182:  $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'].  For some reason, your host is having trouble with HTTP_X_FORWARDED_FOR.  Try changing
} else {
    if (isset($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'])) {
        $hdr_ip = stripslashes($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']);
    } else {
        $hdr_ip = $raw_ip;
    }
}

to
} else {
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $hdr_ip = stripslashes($_SERVER['HTTP_X_FORWARDED_FOR']);
    } else {
        $hdr_ip = $raw_ip;
    }
}


If that doesn't help, you could try removing the HTTP_X_FORWARDED_FOR completely:
} else {
        $hdr_ip = $raw_ip;
}
Title: Re: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_
Post by: seven years on July 19, 2004, 07:09:47 AM
Sorry, that didn't seem to do it. Although you are right, the problem seems to be with that file.... :(
Title: Re: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_
Post by: kegobeer on July 19, 2004, 08:03:22 AM
This is from the online documentation at php.net:

Quote$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the webserver. There is no guarantee that every webserver will provide any of these; servers may omit some, or provide others not listed here.

It may be that your server just plain doesn't handle HTTP_X_FORWARDED_FOR or HTTP_CLIENT_IP.

One last thing to try.  In init.inc.php, after
// Initialise the $CONFIG array and some other variables

try adding

global $HTTP_SERVER_VARS;

Unlike $_SERVER, $HTTP_SERVER_VARS needs to be declared globally (taken right from php.net).  Conversely, you could change all $HTTP_SERVER_VARS to $_SERVER and eliminate the global declaration.
Title: Re: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_
Post by: seven years on July 20, 2004, 01:38:43 AM
No, unfortunately that didn't work.  I guess my server can't handle it.  But nevertheless, thanks for everything.  :-)
Title: Re: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_
Post by: toffey on January 31, 2005, 12:41:45 AM
seven years-- if you find a solution can you email me? i also use fetch and get almost the same error...

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/worstcom/public_html/forums/coppermine/install.php on line 416



my webserver is ipowerweb, has anyone here successfully set this up with them?