我用的友善之臂tiny210的板子
虚拟机用的是Ubuntu的系统
我移植了boa服务器
在ubuntu上写了一个很简单的显示图片的程序
#include
#include
main()
{
printf("Content-type:text/html\n\n");
printf("");
}
生成cgi
gcc -o pic.cgi pic.c
然后导入板子的/www/cgi-bin中,图片放在/www/images里
./pic.cgi后出现错误
[root@FriendlyARM cgi-bin]# ./pic.cgi
./pic.cgi: line 4: ?,4: not found
./pic.cgi: line 4: can't open ?4??
?
??熋: no such file
./pic.cgi: line 4: ?苘?: not found
./pic.cgi: line 4: ? not found
./pic.cgi: line 4: ELFV8?Q^o妸
k?o槝: not found
./pic.cgi: line 5: 冘??
煙? not found
./pic.cgi: line 5: 纻
鄠
? not found ?
[root@FriendlyARM cgi-bin]#
运行后出现了乱码,板子上boa.conf如下:
Port 80
User root
Group root
ErrorLog /dev/console
AccessLog /dev/null
ServerName friendly-arm
DocumentRoot /www/images
DirectoryIndex index.html
KeepAliveMax 1000
KeepAliveTimeout 10
MimeTypes /etc/mime.types
DefaultType text/plain
CGIPath /bin
AddType application/x-httpd-cgi cgi
连接网线后在PC上输入192.168.1.230/cgi-bin/pic.cgi后出现错误
502 Bad Gateway
The CGI was not CGI/1.1 comliant.
我的cgi程序的权限是777,是没有问题的
我之前写的一个显示文本的hello world的程序是没有问题的
就是显示图片之后存在问题
我是个新手,这个问题困扰了我几天了,求大神解答...!!!
谢谢!
查看一下web server的日志等信息,应该是接收请求处理就有问题了
麻烦代码重新贴下,被csdn转义了
502说明你cgi程序本身存在错误。
最可能出现在:“printf("");”这句了。