LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-27-2009, 08:18 PM   #1
gsbear
LQ Newbie
 
Registered: Aug 2009
Posts: 6

Rep: Reputation: 0
What is better than CGI?


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)
 
Old 08-27-2009, 08:46 PM   #2
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
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.
 
Old 08-27-2009, 11:22 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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.
 
Old 08-27-2009, 11:31 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
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.
 
Old 08-27-2009, 11:51 PM   #5
irkkaaja
Member
 
Registered: Oct 2008
Posts: 44

Rep: Reputation: 16
Fastcgi, perhaps? PHP is not an alternative to cgi, though apache modules such as mod_php are.
 
Old 08-28-2009, 01:38 AM   #6
gsbear
LQ Newbie
 
Registered: Aug 2009
Posts: 6

Original Poster
Rep: Reputation: 0
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?

Thanks much
 
Old 08-28-2009, 01:51 AM   #7
irkkaaja
Member
 
Registered: Oct 2008
Posts: 44

Rep: Reputation: 16
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.
 
Old 08-28-2009, 02:54 AM   #8
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
PHP sessions are a convenient way of retaining user login and state information.
 
Old 08-28-2009, 10:30 AM   #9
gsbear
LQ Newbie
 
Registered: Aug 2009
Posts: 6

Original Poster
Rep: Reputation: 0
This is good info, thanks much

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.

Thanks much for your help.
 
  


Reply

Tags
cgi



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
calling CGI script in CGI script ravi_chobey Programming 3 03-19-2009 12:36 PM
Perl CGI:Can't locate CGI.pm supermyself Programming 13 09-10-2007 06:22 AM
CGI to work out side of cgi-bin? crashedspine Linux - Newbie 13 09-02-2004 08:49 PM
apache v2.0.44 + cgi ; securing cgi-support in apache markus1982 Linux - General 0 01-20-2003 01:03 PM
http://www.burstnet.com/cgi-bin/ads/ad7954a.cgi/3980/RETURN-CODE rverlander LQ Suggestions & Feedback 1 06-07-2002 07:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration