manishrathi has asked for the wisdom of the Perl Monks concerning the following question:

How can I configure Perl or PHP in place of C language in web server, if presently C is configured in the webserver ? Can we configure more than one language in the webserver ? for using scripting language like Perl or PHP, I can just put source code in cgi-bin dir. For using C or Java language as CGI script , which needs to be compiled before using it, do I need to put compiled code in the cgi-bin directory ?

thanks

Replies are listed 'Best First'.
Re: configuring language for CGI
by SilasTheMonk (Chaplain) on Dec 22, 2009 at 09:30 UTC

    I think the most useful answer I can give is that *generally* any suitable executable in the "cgi-bin" directory can be a web application. How ever C source code is not an executable so will not work. You would need access to a compiler to be able to use C but only the more expensive web hosting packages will offer that on security grounds.

    Now additional points:

    1. The "cgi-bin" directory is configurable (but not usually by you). For security reasons it should be outside of the document root.
    2. PHP code is normally in the document root not the cgi-bin directory.
    3. When you buy a webhosting package you normally have an idea which languages you want to use and you should check the terms before you buy. But support for languages is definitely server specific and so you need to check.
Re: configuring language for CGI
by Anonymous Monk on Dec 22, 2009 at 04:57 UTC
    Depends on the webserver, now go read the documentation for your webserver.
Re: configuring language for CGI
by rpnoble419 (Pilgrim) on Dec 22, 2009 at 21:12 UTC

    if you use Apache you want to look at the AddHandler cgi-script .cgi .pl command. You may want to refer to the following url:

    http://httpd.apache.org/docs/2.0/howto/cgi.html