Results 1 to 10 of 13
I have an ARM linux board with 2.6.34 LTIB Linux on it with Busybox v1.15.0
I start the httpd server with the following parameters:
httpd -p 80 -h /root/web. The ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-30-2012 #1Just Joined!
- Join Date
- Nov 2012
- Posts
- 6
[LTIB 2.6.34] cgi scripts not working on the httpd server
I have an ARM linux board with 2.6.34 LTIB Linux on it with Busybox v1.15.0
I start the httpd server with the following parameters:
httpd -p 80 -h /root/web. The html pages work.
Then there is /root/web/cgi-bin folder, where I put my cgi scipt. If I try to load the script with "IP-of-the-board/cgi-bin/my-cgi-scipt I get "404 page not found".
I set permissions for the script and the cgi-bin to 777.
I also tried to make my own config file "httpd.conf" and put in into /etc/ with the following content:
But then if I start the server with "httpd" in the console I get "): No such file or directory".Code:H:/root/web I:/root/web/index.html A:*
So the question is - how do I enable cgi on httpd ?
- 12-04-2012 #2
Hello,
I'm not an expert with cgi-scripts in Apache but I can give you one thought.
Make sure you have the "mod_cgi" module loaded and use the "ScriptAlias" directive in your httpd.conf to let Apache know you are running an executable.
mod_cgi - Apache HTTP Server
Cheers,
Srj
- 12-04-2012 #3Just Joined!
- Join Date
- Nov 2012
- Posts
- 6
1. The web server is not Apache but a httpd tool from busybox.
2. If I putin the httpd.conf and launch the httpd I get in the console:Code:ScriptAlias /cgi-bin/ /root/webserver/cgi-bin/
3. On the httpd.apache.org they say:Code:): No such file or directory
But I didnt find any "mod_cgi" files on the linux board.Code:If Apache has been built with shared module support you need to ensure that the module is loaded; in your httpd.conf you need to make sure the LoadModule directive has not been commented out. A correctly configured directive may look like this: LoadModule cgi_module modules/mod_cgi.so
I am desparate with this cgi :S
- 12-04-2012 #4
Hello,
Sorry but I never used the httpd tool from busybox but it working like Apache.
Your error message is a good sign because the "ScriptAlias" directive was understood by the server. (unless your tool is talking about the directive itself when said "No such file or directory").
If the server understood the directive make sure the user running the daemon can access /root/webserver/cgi-bin/.
chroot 755 /root/webserver/cgi-bin (to test it)
Or change the folder's group to apache or whatever you are using.
- 12-04-2012 #5
Oh sorry I just read the initial post again!!!
Busy day at work, don't mind me
Edit:
Sorry but I have no idea how your httpd tool is working. If the user can access the cgi-bin directory then it must be a missconfiguration issue.
Perhaps someone else can help you with busybox httpd.
Cheers,
Srj
- 12-05-2012 #6Just Joined!
- Join Date
- Nov 2012
- Posts
- 6
Nah, I think the httpd didnt understand the directive, because if I use the following https.conf:
and start the server with httpd -v the server starts.Code:H:/root/web
If I use
ORCode:H:/root/web /cgi-bin:foo:bar
I get "): No such file or directory"Code:H:/root/web /root/web/cgi-bin:foo:bar
For the config I looked here:
wiki.chumby com/index.php/Using_the_busybox_HTTP_server]Using the busybox HTTP server - ChumbyWiki
The "/root/web/cgi-bin:foo:bar" should be a valid config command.
- 12-05-2012 #7Just Joined!
- Join Date
- Nov 2012
- Posts
- 6
Another weird thing is that I cant run my cgi script from the console. If I navigate to /root/www/cgi-bin/ and list all files I see the "testcgi" file. If I try to execute this file with "./testcgi" I get "file not found" in the console.

Whats going on oO
- 12-05-2012 #8
Can you please find out what shell are you using?
Try 'echo $SHELL'
If using bash try to run the script with 'bash testcgi'
If using sh try with 'sh testcgi'
I wanted to help you but I have no knowledge with the busybox HTTP server nor with the ARM linux board and 2.6.34 LTIB Linux. I assumed they are working like the others.
Cheers,
Srj
- 12-05-2012 #9Just Joined!
- Join Date
- Nov 2012
- Posts
- 6
echo $SHELL gives me /bin/sh
sh testcgi.sh works. Being in the directory where testcgi.sh is and invoking ./testcgi.sh gives me:
-sh: ./testcgi.sh: not found
Its a normal linux with a normal sh shell =)
- 12-05-2012 #10
I just found something that may be of use to you:
"Since some version, busybox's httpd expects that you are responsible
for generating HTTP headers inside shell script. I.e. you have to do
like this:
echo "HTTP/1.0 200 OK
Content-type: text/html
Connection: close
"
Other examples may be found here:
http://wiki.openwrt.org/doc/howto/http.httpd
WLAN & WIFI: how to setup httpd, CGI script on busybox
Hope this helps,


Reply With Quote
