ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a better way to connect web pages to data than CGI?
I would like to connect my data to the web. Normally we use our proprietary thin client to connect to the server, but I need to use a web interface, and do not want to convert the thin client (C++) to Java or something.
I'm thinking of CGI, but I'm nervous about the single process. I like the idea of ISAPI, but I don't want to use Microsoft servers.
I'm thinking that something better has surfaced since I first played with CGI way to many years ago.
So, what's better than CGI, PHP?
I need to be able to create a state for each user connection, and open a socket to our application server to request and receive data. The rendering in HTML should be cake.
I don't anticipate tons of traffic, but I'm nervous that a poorly implemented connection could slow everything down way too much.
I appreciate your thoughtful suggestions,
A really old timer (my first job was converting 1401 autocoder to Cobol)
If you are going to use a web interface, then your client is going to be a web browser - no matter what you call it.
If your thin client doesn't support HTTP on its network interface, you aren't going to use it for a web interface.
So, really, I don't even understand the question. CGI is a mechanism that web servers understand that let you build server side code that does pretty much anything you have permission to do in any language you care to use. As long as it conforms to the interface that the web server understands, it'll work. PHP is a server side language that Apache, at least, knows how to use to build web pages, control databases, and so forth.
In any case, to have a web interface, your client talks to a web server, and the web server does all the dirty work such as invoking CGI scripts or programs, running PHP, shipping HTML, or whatever.
Just to expand , CGI = Common Gateway Interface ie its basically an API/protocol, not a programming lang. You can do 'CGI' in any programming language you choose eg C++ if that's your bag.
Most go with Perl or PHP.
Shell is no recommended.
As stated above, if you go with this approach, basically any browser (graphical or text will be able to read your page.
If its going to be open to the wrld, this is the approach to take.
If its a controlled list eg workers in your org, you could write a proprietary front end and distribute it eg use/extend your current client sw.
Your choice.
You are going to wind up replacing your thin-client with "something," and that "something" would be some kind of Javascript based monstrosity. (I know. I'm working on one now.)
If you have a thin-client implementation that basically works for a sufficient number of satisfied customers, I would encourage you to conduct a very thorough cost/benefit analysis before throwing any of your babies out with the bath.
My main concern is performance. When I first played with CGI on linux years ago, they were all process based and not multi-threaded. Is that still true, and if so should I be worried?
Also, does anyone have any good ideas for creating a state? Once the user logs in, I want to be able to reference that log in with the following transactions. I suppose I could return an instance number after log in, and save that in a cookie. Is that the current best practice, or is there some better technique?
sessionid cookies are usually used for logins, yes. also, fastcgi or apache modules will perform better than cgi for most applications. i'm not sure which is faster, but it probably depends on the choice of scripting language and the webserver used for fastcgi.
I hadn't heard about FastCGI, but it looks interesting. I'm concerned about portability. I see it's not fully implemented on Apache.
I haven't yet chosen the language, I was thinking C only for familiarity, but I think portability should be my main concern. However I don't want to stray too far from our experience.
Jiml8 suggested PHP has a good way of retaining login and state information. Is there place I can find some samples that show how this is done? I assume I can open a socket and manipulate the data stream.
Would PHP be a good choice for portability across different web servers? One of my hosting sites has implemented both PHP 4 and 5 siting significant differences between the versions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.