| |||||||||||
Running binary programs from a web site Posted by enquirer (enquirer), 10 September 2002 An enquirer asked:"I would like to know if it is possible to launch an executable program (.exe) from within a web site. If yes, can you give me and example to do that ?" Posted by admin (Graham Ellis), 10 September 2002 Yes, you can.Since you talk about a ".exe" file, I'm guessing that you're looking at a piece of compiled code on a Windows system? The easiest way to do this is to set up a form or link on your website to the .exe program in the CGI directory; it should work in just the same way as a CGI script would if it was written in a language such as Perl. That's a very brief overview indeed; if you already know about HTML and CGI, Web servers, etc, it should lead you in the right direction. If my words don't make sense, then you would probably be best to look up on line material about CGI, or a book, or have a look at getting some training depending on your situation. P.S. I'm slightly nervous about running .exe files on webservers; I much prefer scripts. What are you trying to do, as there's a chance that you've asked the "wrong question". Posted by almosthere (almosthere), 11 September 2002 Quote:
This isn't very clear - do you mean launch as in 1) make it run on the server and output on the server, 2) make it run on the person browing the site's computer or 3) make it run on the server and output the results on the person browing's computer? 1) Yes... a system call from a script which has been browsed to is one way 2) No... unless you want to take advantage of poor browser security (which is illegal, i believe....) 3) Yes... see Graham's reply. Any program which can be executed can have its output re-routed via web server software (IIS, Apache etc.). You just need to set up the extensions properly in IIS... it's pretty straightforward. Quote:
Just out of interest... why? almosthere Posted by admin (Graham Ellis), 11 September 2002 You ask why I prefer scripts .... Hmm ... I had better think about that; think my fingers were running away faster that my brain perhaps? But let's think it through ...Firstly, scripts tend to be much more portable than binary executable files; I tell a story on Perl courses that I teach of a script written on Solaris (the original target platform), transferred to a Linux laptop when the installation site I had to visit moved by 300 miles, and than ran AOK under Windows NT which I found at that more distant site. Couldn't have done that with a binary. Somewhat related, you'll need an appropriate compiler for the architecture that your program's going to be running on - not necessarily as easy as you might think if your run Windows, but buy space on a Linux ISP.. For sure, you can get hold of an appropriate gcc, but where will you run it? Secondly, scripting languages are much more acceptable to server admins - they feel they can look inside the code if they need to, and find out what the **** is going wrong if there is a problem. Not sure they would find my obfurscated code too easy, but there you go. Might be possible to have a virus in a web server binary - not so sure about a script? Third point - compiled languages (certainly the ones I'm historically familiar with) are at a much lower level. Code takes much longer to develop, and you have all sorts of nasty dangers like arrays over-running and corrupting memory. Now binaries run as user "webuser", so although an out-of-bounds problem can't kill the operating system, it sure as heck could do damage to the whole web server. Back to the top - I said PREFER and the above are my reasons; you may argue. For certain applications, server side code really ought to be compiled. Just imagine how many more computers folks like Google would need if their code was all in a script language. Such applications are the exception, though. Oh - and I'll count Java with its portable public binary format as an honorary scripting language in this discussion if you should twist my arm! Posted by admin (Graham Ellis), 14 September 2002 An update on the original post; I have learnt (by email) that the error message was "POST method not allowed at this URL" ... so here is my further answer, also of general interest.There are two ways of accessing data on a web server - the GET and POST methods. GET is used for normal HTML files and sometimes executable programs, POST is really only used for executable programs. Your form tag specifies that POST is to be used, but the server doesn't allow it. Either reconfigure the server, or remove the method="post" from the HTML to overcome this problem ... but I do suspect that you'll then just run into the *next* problem ... A further thing that I must alert you to. If you don't have the source code, then you have probably purchased a license to use the .exe software. It is probable that this is a single user license, so it is probable that it would be illegal for you to install the software on a web server where there could be multiple concurrent users. Please check this, as the situation will differ depending on the terms of the software license, and the law in the country it was purchased and (perhaps) where the web server is located. A minefield! This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |