Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

BOA CGI problem hasn't been fixed

This days i try to complete the CGI function in the uClinux BOA of my 1s10 board,but no results.

And wanna achieve the ledcontrol (http://www.niosforum.com/forum/index.php?act=st&f=18&t=2185) via the cgi function on boa.

I have tried different ways.

>1:index.html //add to home/httpd folder.

follow what KEN's method, change "POST" to "GET":


<html>
<head>
 <title>CGI script test</title>
</head>
<body>
 <form method="get" action="http://202.112.147.82/cgi-bin/test.cgi">
 <input type="submit" value="ok">
</form>
</body>
</html>

>2:creat test.cgi //add to home/httpd/cgi-bin folder.

one way:

##  cgi-bin/test.cgi# 
# ! /bin/sh
echo "Content-type: text/html\n\n"
echo
echo "The cgi script is working\n"

another way://Compile to test.exe,then add test.exe to home/httpd/cgi-bin folder.

#include <stdio.h>
void main(void)
{
printf("content-type: text/html\n");
printf("\n");
printf("the cgi script is working\n);
exit(0);
}

Unfortunately,error in IE browser: the page cannot be displayed,server inner error...

Also i browsered the concerning topic, just like the TOPIC:"How to use boa?" by sunclever.

No result to find,even i follow the same way, but no success.

Any help would be greatly appreciated!

Thank you very much!

Best regards!

Justin

12 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi schaney,

    > nope. It can&#39;t recognize echo. Any idea why the script wouldn&#39;t work?

    This sounds weird ... I ran the following script without any problems:
    #!/bin/sh
    echo "Content-type:text/html\n\n"
    echo "The cgi script is working\n"
    Here are a few things to check:

    1. Try the following command:

    $ echo $PATH

    If this doesn&#39;t work ... you&#39;re probably missing &#39;echo&#39;.

    2. Check your PATH environment

    If the PATH env var doesn&#39;t include the directory where echo actually is, you&#39;ll either need to add the

    full path to your script, or setup PATH in your /etc/rc file. Or from the command line:

    $ export PATH=$PATH:<path to echo>

    Then try running the script again.

    Regards,

    --Scott
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    That would be the problem. I didn&#39;t have the sh utilities built into the filesystem.

    Thanks,

    Scott