File Upload / PHP CGI Problems



When I have PHP set to run as a CGI, my file upload scripts get this error:

Warning: Unexpected character in input: ’ ’ (ASCII=12) state=1
in /usr/local/dh/cgi-system/php.cgi on line 2788

Parse error: parse error, unexpected T_STRING in /usr/local/dh/cgi-
system/php.cgi on line 2788

When I don’t have it set to run as a CGI I don’t get an error but the files that are uploaded are then owned by the apache server and I have to set my directory permissions to 777.

If it were a problem with the file uploading as binary for some weird reason, it shouldn’t work when PHP isn’t running as a CGI should it?



ASCII character 12 is a formfeed character. Maybe that script is expecting plain ASCII text with no control codes in it?

– Dan


I run PHP as a CGI and I’ve never had that error uploading files.