Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
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.
  1. #1
    Just Joined!
    Join Date
    Nov 2012
    Posts
    6

    Unhappy [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:

    Code:
    H:/root/web
    I:/root/web/index.html 
    A:*
    But then if I start the server with "httpd" in the console I get "): No such file or directory".

    So the question is - how do I enable cgi on httpd ?

  2. #2
    srj
    srj is offline
    Just Joined! srj's Avatar
    Join Date
    Jan 2012
    Location
    Bucharest
    Posts
    86
    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

  3. #3
    Just Joined!
    Join Date
    Nov 2012
    Posts
    6
    1. The web server is not Apache but a httpd tool from busybox.

    2. If I put
    Code:
    ScriptAlias /cgi-bin/ /root/webserver/cgi-bin/
    in the httpd.conf and launch the httpd I get in the console:
    Code:
    ): No such file or directory
    3. On the httpd.apache.org they say:
    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
    But I didnt find any "mod_cgi" files on the linux board.

    I am desparate with this cgi :S

  4. $spacer_open
    $spacer_close
  5. #4
    srj
    srj is offline
    Just Joined! srj's Avatar
    Join Date
    Jan 2012
    Location
    Bucharest
    Posts
    86
    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.

  6. #5
    srj
    srj is offline
    Just Joined! srj's Avatar
    Join Date
    Jan 2012
    Location
    Bucharest
    Posts
    86
    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

  7. #6
    Just Joined!
    Join Date
    Nov 2012
    Posts
    6
    Nah, I think the httpd didnt understand the directive, because if I use the following https.conf:
    Code:
    H:/root/web
    and start the server with httpd -v the server starts.

    If I use
    Code:
    H:/root/web
    /cgi-bin:foo:bar
    OR

    Code:
    H:/root/web
    /root/web/cgi-bin:foo:bar
    I get "): No such file or directory"

    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.

  8. #7
    Just 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

  9. #8
    srj
    srj is offline
    Just Joined! srj's Avatar
    Join Date
    Jan 2012
    Location
    Bucharest
    Posts
    86
    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

  10. #9
    Just 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 =)

  11. #10
    srj
    srj is offline
    Just Joined! srj's Avatar
    Join Date
    Jan 2012
    Location
    Bucharest
    Posts
    86
    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,

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •