Unexpected Character

I wasn’t getting any Google lovin’, so I post this for myself in case it happens again.

Accessing the PHP CGI directly (if you — hypothetically, say — redirected to $_SERVER['SCRIPT_NAME'] with PHP in CGI mode) can spring errors like so:

Warning: Unexpected character in input: '' (ASCII=6) state=1 in /usr/local/dh/cgi-system/php.cgi on line 124  
Warning: Unexpected character in input: '' (ASCII=8) state=1 in /usr/local/dh/cgi-system/php.cgi on line 124
Parse error: parse error, unexpected '/' in /usr/local/dh/cgi-system/php.cgi on line 124

Try $_SERVER['PHP_SELF'].

   
This entry was posted on Tuesday, January 25th, 2005, in the categories “”, “PHP”, “help” and “note to self”.

Thus far, 2 responses.

Reckoned Bill Lovett:

Thanks for posting this– I was running into the exact same problem (also on a Dreamhost server, by the look of things) and the PHP_SELF thing TOTALLY fixed the problem.

Recorded Jim:

Same thing here.

Dreamhost - trying to run phplayersmenu.

Thanks for the tip.

Leave a Reply