Unix Technical Forum

C-Language CGI-BIN Programming with MySQL

This is a discussion on C-Language CGI-BIN Programming with MySQL within the MySQL forums, part of the Database Server Software category; --> Because I have some heavy number-crunching scientific applications, I'd like to program using the C language, CGI-BIN, and with ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 09:32 AM
David T. Ashley
 
Posts: n/a
Default C-Language CGI-BIN Programming with MySQL

Because I have some heavy number-crunching scientific applications, I'd like
to program using the C language, CGI-BIN, and with MySQL (using its
C-language interface).

Is there anything I should know? For example, when Apache runs a CGI-BIN,
is there anything special about the environment (memory limits, etc.)?

Is the paradigm I proposed workable?

Thanks, Dave.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 09:33 AM
The|Godfather
 
Posts: n/a
Default Re: C-Language CGI-BIN Programming with MySQL

Some remarks,
Do not use CGI-BINs cause they are vulnerable to some attacks. If you
use mySQL directly with the Apache Server to do queries you will
probably end up using PHP interface to communicate with mySQL Server.
Do noy install the PHP plug-in as a CGI-BIN but as a module.

Cheers,
Dragomir Stanchev

http://www.linkedin.com/in/dragomirstanchev
http://www.student.informatik.tu-dar...%20deutsch.pdf

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 09:33 AM
David T. Ashley
 
Posts: n/a
Default Re: C-Language CGI-BIN Programming with MySQL

"The|Godfather" <dragomir.stanchev@gmail.com> wrote in message
news:1163249856.490287.269010@h54g2000cwb.googlegr oups.com...
> Some remarks,
> Do not use CGI-BINs cause they are vulnerable to some attacks.
>


Do you have any URL's describing attacks. I'm curious. Thanks.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 09:33 AM
Jerry Stuckle
 
Posts: n/a
Default Re: C-Language CGI-BIN Programming with MySQL

The|Godfather wrote:
> Some remarks,
> Do not use CGI-BINs cause they are vulnerable to some attacks. If you
> use mySQL directly with the Apache Server to do queries you will
> probably end up using PHP interface to communicate with mySQL Server.
> Do noy install the PHP plug-in as a CGI-BIN but as a module.
>
> Cheers,
> Dragomir Stanchev
>
> http://www.linkedin.com/in/dragomirstanchev
> http://www.student.informatik.tu-dar...%20deutsch.pdf
>


I agree with Dave. Some specific CGI-BIN's may be prone to attacks.
But that is not a reason not to use CGI-BIN's. Please provide solid
references (not rumors) supporting your statement.

Many people use languages other than PHP to communicate with MySQL - and
believe it or not, those people are running under Apache. They use
languages such as Perl or Python, for instance.

And believe it or not, there are actually people using C/C++ with Apache
to do cpu-intensive work.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 09:33 AM
Jerry Stuckle
 
Posts: n/a
Default Re: C-Language CGI-BIN Programming with MySQL

David T. Ashley wrote:
> Because I have some heavy number-crunching scientific applications, I'd like
> to program using the C language, CGI-BIN, and with MySQL (using its
> C-language interface).
>
> Is there anything I should know? For example, when Apache runs a CGI-BIN,
> is there anything special about the environment (memory limits, etc.)?
>
> Is the paradigm I proposed workable?
>
> Thanks, Dave.
>
>
>


Dave,

Yes, it's workable. You can access MySQL quite easily from C/C++. From
the Apache end it all depends on what language you're going to use for
the server-side scripting.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-28-2008, 09:33 AM
Mel Smith
 
Posts: n/a
Default Re: C-Language CGI-BIN Programming with MySQL

David said:
> > Because I have some heavy number-crunching scientific applications, I'd

like
> > to program using the C language, CGI-BIN, and with MySQL (using its
> > C-language interface).


David:

I program in the xHarbour language (a C-based language). Several members
of our users group (www.xharbour.org and www.xharbour.com) use the Harbour
language to create executables (.exe's) for usage as CGI-Bin. I tried this
once myself a year or so ago (but only using localhost to train myself).

Harbour applications are compiled into 'C' functions, then those
functions are further compiled into .obj code, and then linked into an
executable. The Harbour language probably contains all the
number-crunching stuff you'll ever need. But, *in addition*, it is has a
native high-speed facility to use databases of a wide variety (because of
Replaceable Data Drivers - RDDs). I believe that C-librairies can be linked
into and be used with a Harbour app (but *may* have to be re-compiled). You
can either build your own xHarbour compiler (from downloade C-source code or
download the binary compiler (harbour.exe) from the users group.

Of the several choices of C-Compiler that can be used, my choice is
Borland's *free* Command Line Tools, which contains BCC 5.5 -- there are
other C compilers available also which are just as good (apparently).

The most widely used RDD in Harbour is similar to the FoxPro-type of
database (i.e., like the old style dBase databases). Much more modern of
course. So, the access from the Server (i.e., your xHarbour .exe) your
Database is extremely fast -- certainly much faster than SQL access.

Since, I'm *not* a guru, but simply an application programmer, I suggest
you join the Users' Forum, and 'smell around' for awhile. Anybody that came
up thru the past 15-20 years of xBase programming will be delighted at the
progress of this language -- all open source too.

btw, the xHarbour language (eXtended Harbour) is a big step forward over
the original Harbour language (both of these were began in 2001 and are
advancing very fast !

Please excuse the sales pitch !

Good Luck !

-Mel Smith


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-28-2008, 09:33 AM
Axel Schwenke
 
Posts: n/a
Default Re: C-Language CGI-BIN Programming with MySQL

"David T. Ashley" <dta@e3ft.com> wrote:
> Because I have some heavy number-crunching scientific applications, I'd like
> to program using the C language, CGI-BIN, and with MySQL (using its
> C-language interface).


I don't see the link from "number-crunching scientific applications"
to using CGI. Heavily frequented web applications don't use CGI because
it spawns a new process per request. More common is the ->fastCGI
approach. With Apache you can even use one of the many extensions - or
write your own. The Apache API is quite straightforward. Implementing
a content handler is not much harder than writing a CGI app.

Additionally: why not PHP or Perl? Do you do numbercrunching in the
web app? If yes - most numbercrunching stuff is done in a C library
function and just called from the script interpreter. I.e. if you do
some big-integer arithmetics in a Perl script using Math::GMP, all
the cpu consuming things will be done in libgmp. Writing the glue code
in C would gain you next to nothing.

> Is there anything I should know? For example, when Apache runs a CGI-BIN,
> is there anything special about the environment (memory limits, etc.)?


Read it up in the Apache docs. Some things are configurable.


XL
--
Axel Schwenke, Senior Software Developer, MySQL AB

Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:18 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com