Hi, I'm trying to use the simple "Hello World" as a cgi and I always get error 502 Bad Gateway The CGI was not CGI/1.1 compliant. I'm able to use the default index.html and its cgis (led control for example), but when i use my "hello world" cgi in c language and compile it, it doesn't work. I'm placing my cgi's and html files in the directory /www (the same of the index.html) here is my html: <html> <body> <P><A HREF="helloworld.cgi">RUN helloworld.cgi</A>.</P> </body> </html> and here is my c code for cgi: void main() { printf("Content-type:text/html\n\n"); printf("<html>\n") ; printf("<head><title>CGI Output</title></head>\n") ; printf("<body>\n") ; printf("<h1>Hello, world.</h1>\n") ; printf("</body>\n") ; printf("</html>\n") ; exit(0) ; } Can any one tell me how to get this to work? Thanks.
MY CGI DON'T WORK, WHY?
Hello Sharp. I did what you said, and now I'm not getting the 502 error anymore. But when I try to execute the CGI, clicking on its link in the browser, the browser ask me to SAVE the file instead of just execute it. I tried to use the chmod 777 to force it to become an executable but it didn't work too. I'm compiling it with this: gcc helloworld.c -o helloworld.cgi I'm placing the files in the /www/ directory of my mini2440. Could the way i'm compiling, or the location of the files be the problem? Thanks!
Actually I'm getting the 502 error when i try to make the cgi and html run on arm. I tried the chmods i said before and it's still not working. When i run it on ubuntu boa's server I don't get the 502 error, but I'm still not able to execute the cgi file (the browser ask me to save it instead of execute i). Any ideas? PS: My HTML skills are really bad...
I think your problem is the location of the cgi files. I use mini-httpd on my Mini as web server, and it needs to be the cgi scripts in "cgi-bin" named folder ( you can change it in a configuration file ). Check out your configuration file for your web server. Good Luck Sharp
Thanks again Sharp. I solved the problem. Apparently my problem was not the cgi's location. After some long researchs on google i found some different c codes for a helloworld cgi. Basically i changed the line that was: printf("Content-type:text/html\n\n"); for something slightly different and now it runs fine. Thank you for all your cooperation!
Hi Felipe, Could you please share your sollution to this problem? I've been stuck with the same issue for hours now. It would be of great help if you can share the exact change that you made to the following line printf("Content-type:text/html\n\n"); Thanks in advance!
Hi Prakash, I think Felipe was refering to this post: http://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action... You need to use: printf("Content-type: text/html\r\n"); printf("\r\n"); I hope you already fixed this one year old issue, I'm just posting here to help other people facing same problem.
Hey guys, I'm working on a similar project on the tiny6410 and I'm getting the same error '502 Bad Gateway The CGI was not CGI/1.1 compliant.' For this test program, I've used the same code and filenames mentioned above with the correction mentioned by Alan. Any clues on where I may be going wrong? Do I need check the mapping of the cgi file? I kept it in the /www/ directory with the html file. Any input would be appreciated Regards Ved
Hi, I'm getting the same error 502. I have changed the printf() statement as per suggested in the discussion. I checked the error log and i'm getting this error - cgi_header: Unable to find LFLF. I don't know what it means. I have the html file and the cgi file in the DocumentRoot folder which is /www on Micro2440 Board. Here is my addition.html file <html> <head> <title> Boa Web Server Testing </title> </head> <body> <h1>Integer Addition Testing</h1> <form action="myfirstcgi.cgi" method="get"> <table> <tr><td>Enter first number</td> <td><input type=text name=number1></td> </tr> <tr><td>Enter second number</td> <td><input type=text name=number2></td> </tr> <tr><td colspan=2> <input type = submit value = "Calculate Sum" > </td> </tr> <input type=hidden name=cmd value="addition"> </table> </form> </body> </html> In the Form action field - when i don't write .cgi extension, the browser downloads my cgi file instead of returning the output.
Hi, I am working similar project with cgi using C programming I am facing the similar problem 502 Bad Gateway Error When I try to submit form with empty fields and I am validating the fields using Javascript it doesn't seems to be working please help me get out of this problem Thanks in advance
Hello sir, I want to create a web page inside the MINI2440 in this page there is some user setting menu and factory setup. and access this page like intranet or any browser (http://192.168.1.1:8080/). There is any documents to install these thinks. Thanks in advance.