On Fri, Jun 13, 2008 at 09:28:02PM +0200, Nyizsnyik Ferenc wrote: > On Fri, 13 Jun 2008 22:03:58 +0300 > ccostin <[EMAIL PROTECTED]> wrote: > > > Hello > > > > What is the minimal configuration for httpd.conf required by busybox > > httpd to run simple CGI scripts ?
I believe that busybox in Etch does not support it yet. Generally busybox is a rather slow-moving package, due to its usage in the installer. Consider downloading it from source and rebuilding. It's a single binary. > > For this are necessary any special environment exported variables ? > > > > When I try to load simple bourne shell scripts, Iceweasel ask me to > > save them on disk. > > > > Command line for busybox is > > busybox httpd -h /var/www/ > > and shell scripts are contained in /var/www/cgi-bin/, and have a+x > > execution bits. > > > > Sounds like a problem with the content-type. Make sure you set it to > text/html, like the following simple script: > > #!/usr/bin/bash /bin/bash fir a script? I figure busybox ash would be faster (and may even save you time on for/exec, as it's the same binary). shell scripts may be useful for trivial CGI scripts. But for anything more complicated they become rather slow. And I really don't trust them to handle input correctly. The busybox "tiny unitities" page recommends microperl and lua. microperl requires rebuilding perl. The result, though, is a more limited perl variant, but also considerbly smaller (e.g: 1MB vs. 5MB) and hence faster to load and requires less memory. > echo -e "Content-type: text/html\n\n"; > echo -e "Hello world.\n"; We all love benchmarks, right? I ran the following with: bash 3.2-4 busybox 1:1.10.2-1 dash 0.5.4-9 pdksh 5.2.14-23 posh 0.6.8 zsh 4.3.6-4 coreutils 6.10-6 (for shells with no built-in 'echo') lua40 4.0-13 lua50 5.0.3-3 perl 5.10.0-10 python2.4 2.4.5-2 python2.5 2.5.2-6 ruby1.8 1.8.7-2 I ran the following several times for each shell, and the one I provide here is a "typical" run. There wasn't great variance anyway. bash: $ time (for i in `seq 1000`; do bash -c 'echo -e "Content-type: text/html\n\n"; echo -e "Hello world.\n"'; done >/dev/null) real 0m3.220s user 0m1.328s sys 0m2.036s dash: $ time (for i in `seq 1000`; do dash -c 'echo -e "Content-type: text/html\n\n"; echo -e "Hello world.\n"'; done >/dev/null) real 0m1.242s user 0m0.456s sys 0m0.932s posh: $ time (for i in `seq 1000`; do posh -c 'echo -e "Content-type: text/html\n\n"; echo -e "Hello world.\n"'; done >/dev/null) real 0m1.378s user 0m0.536s sys 0m0.916s $ time (for i in `seq 1000`; do pdksh -c 'echo -e "Content-type: text/html\n\n"; echo -e "Hello world.\n"'; done >/dev/null) real 0m1.456s user 0m0.664s sys 0m0.908s zsh: $ time (for i in `seq 1000`; do zsh -c 'echo -e "Content-type: text/html\n\n"; echo -e "Hello world.\n"'; done >/dev/null) real 0m3.892s user 0m1.760s sys 0m2.308s busybox ash: $ time (for i in `seq 1000`; do busybox ash -c 'echo -e "Content-type: text/html\n\n"; echo -e "Hello world.\n"'; done >/dev/null) reel 0m1.390s user 0m0.496s sys 0m1.108s rc: $ time (for i in `seq 1000`; do rc -c 'echo -e "Content-type: text/html\n\n"; echo -e "Hello world.\n"'; done >/dev/null) real 0m1.870s user 0m0.808s sys 0m1.188s So larger shells take much more time to load. They make up to this if you actually use their built-in abilities wisely to save processing with external utilities. But is it worth it? So let's check some other languages: perl: $ time (for i in `seq 1000`; do perl -e 'print "Content-type: text/html\n\n"; print "Hello world.\n"'; done >/dev/null) real 0m2.788s user 0m1.200s sys 0m1.708s perl, loading the module CGI: $ time (for i in `seq 1000`; do perl -MCGI -e 'print "Content-type: text/html\n\n"; print "Hello world.\n"'; done >/dev/null) real 0m29.725s user 0m25.350s sys 0m4.616s lua40: $ time (for i in `seq 1000`; do lua40 -e 'print "Content-type: text/html\n\n"; print "Hello world.\n"'; done >/dev/null) real 0m1.595s user 0m0.588s sys 0m1.112s lua50: $ time (for i in `seq 1000`; do lua50 -e 'print "Content-type: text/html\n\n"; print "Hello world.\n"'; done >/dev/null) real 0m2.244s user 0m0.996s sys 0m1.332s ruby: $ time (for i in `seq 1000`; do ruby1.8 -e 'print "Content-type: text/html\n\n"; print "Hello world.\n"'; done >/dev/null) real 0m5.979s user 0m3.976s sys 0m2.212s python2.4: $ time (for i in `seq 1000`; do python2.4 -c 'print "Content-type: text/html\n\n"; print "Hello world.\n"'; done >/dev/null) real 0m12.668s user 0m8.245s sys 0m4.664s python2.5: $ time (for i in `seq 1000`; do python2.5 -c 'print "Content-type: text/html\n\n"; print "Hello world.\n"'; done >/dev/null) real 0m14.134s user 0m9.609s sys 0m4.720s Note that this is a very minimal script. If it got more complicated, "smarter" interpeters would start showing their abilities. -- Tzafrir Cohen | [EMAIL PROTECTED] | VIM is http://tzafrir.org.il | | a Mutt's [EMAIL PROTECTED] | | best ICQ# 16849754 | | friend -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]