You have several choices, mentioned on the Tclhttpd page:
Choose one. CVS is likely to be the most up-to-date, snapshots next most up-to-date. Distributions most convenient, but currently have old bugs.
Grab your source, read the README.
There are pretty extensive online manuals, documentation and even a chapter from a book ... but of course you need to get tclhttpd up and running before you can read them.
The TclHttpd Book Chapter from the 3rd Edition of Practical Programming in Tcl and Tk by Brent Welch can be found here [L1 ].
If your using the Starkit Distribution, the Starkit Book Chapter from the 4th Edition of Practical Programming in Tcl and Tk by Brent Welch can be found here [L2 ].
LV I don't understand this comment. Why do you have to get a web server up and running before reading documentation? Generally one can point a web browser at HTML files and have them formatted without having a web server. Does tclhttpd come with the docs in some strange format that is nearly unreadable unless processed with tclhttpd?
I just took at look at the tclhttpd CVS snapshot (which doesn't seem to have been updated since April 2005 for some strange reason...or is the snapshot software at activestate broken?) and I see plain text files, a doc/httpd.1 man page, ht_docs/book/TCLHTTPD.html file (so that can be read without a server), and a couple of html files in htdocs/manual. However, there are a lot more .tml files than I would have expected to find.
There are 2 URLs listed for documentation; I would hope that the formatted versions of the docs are there.
A bigger question is this - can a user with no experience administering a web server get enough help from the README and other files to put up a secure tclhttpd server onto the internet? If not, pointers to resources towards that goal seem like a useful addition to the README file... if resources for the complete novice are available, then the more expert admin will probably be able to start things up.
I was a bit confused that the first text in the README talks about running the starkit, but then seemed to find that the starkit wasn't a part of the CVS .
There are Wiki pages and a mailing list.
Things You Might Need to Know about Tclhttpd
There is a custom/ directory whose contents is sourced into tclhttpd at startup. You can add stuff in there.
The startup file is called httpd.tcl, and sources httpdthread.tcl and uses tclhttpd.rc - where they're installed depends upon your distribution and installation choices.
I'd like to learn tcl/tk well, especially for Web-based programming. Had done so till now in PHP. I'm reading Brent Welch's fine book.
Well, I got tclhttpd installed on my WIN2000 box. But I can't get my small source file (x.tcl) to run in the browser. It lets me go as far as "http://localhost:8015 ".
Do I need to declare a "virtual directory" in tclhttpd as I would in WIN2000's IIS? Can you tell me how I "point" my browser to my tiny source file that contains not much more than [clock format [clock seconds]]]? I'd appreciate your help.
P.S. I've read some literature the httpd home page offers, but - frankly - it's more like Chinese to me. It seems the people "into" this technology just can't explain it well enough to guys like me who, unfortunately, were made stupid and straighjacketed by Microsoft point-and-shoot dumbed-down simplicity. If you could hold my hand a bit - I'd be grateful.
Jeff Smith I am no expert but email me the file and I will try to get it to work for you.
Meir Thanks Jeff; It's not the file that's the problem; It's no more than: puts "The time now is: [clock format [clock seconds]]]" It's getting my browser to access my source.
For example, on WIN2000(IIS) & PHP, I create a "virtual directory" in IIS, e.g. "MyVirtual", then in the browser use that name as part of the URL to "get to" my script eg., "http://localhost/MyVirtual/test.php ". But for tclhttpd - I'm lost. I only got as far as my browser "recognizing" http://localhost:8015 .
Much obliged, thanks.
Jeff Smith The easiest way to achieve this is to create a file called x.tml and place it in the htdocs directory. In the file put the following
[Doc_Dynamic] The time now is: [clock format [clock seconds]]
Does this help? Feel free to ask again!
LES: I also didn't find the documentation very clear. And the "need to get tclhttpd up and running before you can read the manuals" (stated above) reminds me of those funny candy containers that are hard to open and bring the opening instructions... on the inside.
Yipee; It worked. Thanks a lot Jeff;
I'm left puzzled however; Why does the following code work
The time now is: [clock format [clock seconds]]]
...and were I to write
puts "The time now is: [clock format [clock seconds]]]"
puts "The time now is: Tue Nov 29 9:17:33 AM Eastern Standard Time 2005"
...Why is the tcl command "puts" ignored? How can I code in tcl when some of my commands "take" and others don't ???
MG This is only a guess, but it seems whatever routines are used for parsing the Tcl only parse what's inside square brackets, and print the rest out as text verbatim. So, instead of
puts "The time now is: [clock format [clock seconds]]"
[puts "The time now is: [clock format [clock seconds]]"
Come on MG - That makes no sense; And bracketing the code doesn't work anyhow!
Jeff Smith In TclHttpd there are numerous ways to achieve the same result. In this example I used what is known as the Template system. From the TclHttpd documentation "The template system uses HTML pages that embed Tcl commands and Tcl variables references. The server replaces these using the subst command and returns the results." Therefore to make the above example output in bold
[Doc_Dynamic] <B>The time now is: [clock format [clock seconds]]</B>
So when you use the template system, as MG suggested, you need to enclose all your Tcl commands in square brackets. However the puts command sends its output to stdout by default not to the socket the browser is communicating over. So
[puts "The time now is: [clock format [clock seconds]]"]
displays a blank page in the browser. If you have started TclHttpd from the command line you can actually see that the output has gone to stdout
can't find package limit Running with default file descriptor limit /debug user "debug" password "2hjbgan2frdy" httpd started on port 8015 The time now is: Wed Nov 30 08:58:58 EST 2005
This is handy to know when you are debugging. You can use
in your pages to see the state of any variable at certain stages when the page is being processed.
Meir My apologies MG; Thank you.
rahul - 2009-09-14 01:54:58
Hello all....i need to integrate a normal server i am running in TCL with tclhttpd.....its like..when i am running the server a client shd be able to access it from a webbrowser by just typing the ipaddress and the port number.
I also need to know....what if i create a html file in httddocs and run it on the websbrowser....the fields are coming fine...but once in click okay or submit...where does all the information go...or where shd i redirect them to check them later.
rahul, have you looked at the online tclhttpd chapter from Welch's book ? See the reference towards the top of this page. It answers both your questions in some significant detail.
rahul - 2009-09-16 07:26:43
Thanx for replying to my previous queries..here is one more...i am running a web server using tcl httpd and at a point if i have to get information from server and display them dynamically in the next page..what should i do?
its like if i press a form in the page..i need to access the output of the command which i am sending to the server when i press the form.
thank you in advance
tb - Hi Rahul! I don't know whether I got you right, but if you use the method "GET" with your form, you should see all the code that goes to your server in the address field of your browser. Hope that helps :)
APN rahul, please do not enter your text below the Category lines below. Regarding your question, it's still not clear what you are asking? Are you asking how to access the data sent within the form from inside tclhttpd? Or are you asking how to access what tclhttpd generates on the client (browser) side? If the latter, that really is not a tclhttpd question. If the former, please see pages 244 onward in the online chapter from Welch's book I referenced earlier and come back if you have doubts.
rahul - 2009-09-22 07:26:43
Hello all.I am currently trying to run httpd from linux.....tcl software is shared from a common server and when i copy tclhttpd to my name space dir(/home/rahul...) and run httpd i am getting errors..can any one tell me whats going wrong and how to rectify the mistake