Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

boa problems

Altera_Forum
Honored Contributor II
2,000 Views

Please see attachment

0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
785 Views

hi zzh  

 

i will help until the resolution of your problem if God wants it http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

 

if i understand well, u can access the index.html but cgi dont work ? 

 

if u access the index.html it means that boa works. 

 

but when I took a look to your html code, I remarque that u use POST methode for FORMs, I hope u use GET methode cause it&#39;s easier, until we see were is the problem
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Hi,sdhnian 

Thank you for your advice. 

 

yeah,The boa work ,but cgi program doesn&#39;t . 

That is the problem. 

 

"Get" method don&#39;t change the "HTTP 404 not found " error. 

I tried.
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

hi zzh 

 

don&#39;t give up, try this simple example : 

 

************* html code : index.html****************** 

 

<FORM method="get" ACTION="mult.cgi" > 

 

 

Please specify the multiplicands: 

<INPUT NAME="m" SIZE="5"> 

<INPUT NAME="n" SIZE="5"> 

 

<INPUT TYPE="SUBMIT" VALUE="Multiply!"> 

</FORM> 

 

**************************************** 

 

************** cgi code : mult.c****************** 

# include <stdio.h># include <stdlib.h> 

int main(void) 

char *data; 

long m,n; 

printf("%s%c%c\n", 

"Content-Type:text/html;charset=iso-8859-1",13,10); 

printf("<TITLE>Multiplication results</TITLE>\n"); 

printf("<H3>Multiplication results</H3>\n"); 

data = getenv("QUERY_STRING"); 

if(data == NULL) 

printf(" 

 

Error! Error in passing data from form to script."); 

else if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2) 

printf(" 

 

Error! Invalid data. Data must be numeric."); 

else 

printf(" 

 

The product of %ld and %ld is %ld.",m,n,m*n); 

return 0; 

 

****************************************************** 

 

******************** Makefile : Makefile***********************# # configurable options# - set DEBUG = 1 to turn on debugging support#  

DEBUG = 1 

PROJ_NAME = mult 

INSTALL_DIR =  

PROGS := $(PROJ_NAME).exe 

CFLAGS += 

# # You should not need to modify anything beyond this point#  

TOPDIR = . 

include ./Rules.mak 

 

ifeq &#39;$(DEBUG)&#39; &#39;1&#39; 

PROGS += $(PROGS:.exe=.gdb) 

endif 

 

all: $(PROGS) 

 

.PHONY: clean 

clean: 

-rm -f *.[oad] *.elf *.gdb *.bin *.exe 

 

.PHONY: install 

install: all 

ifeq "$(INSTALL_DIR)" "" 

$(error No installation directory specified) 

endif 

mkdir -p $(INSTALL_DIR)/bin 

install -v $(filter %.exe, $(PROGS)) $(INSTALL_DIR)/bin 

 

*************************************************************** 

 

steps to follow : 

 

--> create a new uclinux application 

--> add "mult.c" and "Makefile" to project 

--> right click on project :  

-- creat make target --> yes 

-- build make target 

--> if compilation success it will create a multi.exe 

--> add "index.html" and "mult.exe" to httpd derictory on file system 

--> rename "mult.exe" by "mult.cgi"  

 

and go ! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Hi. 

I will try tomorrow.hehe. 

Thank you very much!!!!!!!! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

Hi,shhnain. 

OK it works . Thank you very much!! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif  

 

but i am coufused. 

 

ScriptAlias: /cgi-bin/ /home/httpd/cgi-bin/ 

why in the index.html , the action="/cgi-bin/mult.cgi" is not work. 

of course we place mult.cgi to /home/httpd/cgi-bin/. 

 

Does we must place cgi programs into /home/httpd ?
0 Kudos
Altera_Forum
Honored Contributor II
785 Views

 

--- Quote Start ---  

originally posted by zzh@May 5 2006, 03:32 AM 

hi,shhnain. 

ok it works . thank you very much!! http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/biggrin.gif  

 

but  i am coufused. 

 

scriptalias: /cgi-bin/  /home/httpd/cgi-bin/ 

why in the index.html , the action="/cgi-bin/mult.cgi"  is not work. 

of course we place mult.cgi to /home/httpd/cgi-bin/. 

 

does we must place cgi programs into /home/httpd ? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=15068) 

--- quote end ---  

 

--- Quote End ---  

 

 

 

hi, thanks to GOD, it works 

 

cgi files can be placed at any folder but I remarque that u use action="/cgi-bin/mult.cgi"  

 

I think u have to try : action="cgi-bin/mult.cgi" because cgi-bin is directly under /home/httpd  

 

good luck http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
0 Kudos
Reply