Making websites with C, PHP, Javascript

Discussion in 'Web Design and Development' started by zoomvroom89, Sep 15, 2008.

  1. zoomvroom89 macrumors newbie

    Joined:
    Aug 29, 2008
    #1
    Hi,

    I'm trying to make a dynamic website, and found out that the backend can only be done in C. My question is that if I want to use C as the backend and say, PHP, as the frontend, how would I integrate the two? Soap calls back and forth? Some custom module?
     
  2. italiano40 macrumors 65816

    italiano40

    Joined:
    Oct 7, 2007
    Location:
    NY
    #2
    i think that you want to use PHP as the backend and Javascript as the frontend, i never heard of C as backend for a web site
     
  3. zoomvroom89 thread starter macrumors newbie

    Joined:
    Aug 29, 2008
    #3
    Apparently sites like meebo can do it, but they wrote a custom module, dubbed 'mod_meebo'
     
  4. Aranince macrumors 65816

    Joined:
    Apr 18, 2007
    Location:
    California
    #4
    You can write PHP and/or Apache modules in C that allow you to do stuff in PHP that you can only do in C. You write the actual website stuff in PHP.
     
  5. italiano40 macrumors 65816

    italiano40

    Joined:
    Oct 7, 2007
    Location:
    NY
    #5
    wow never heard of that, i not to much into web site, but i usally use PHP as my backend and javascript, i may have to try C as my backend
     
  6. bootedbear macrumors 6502

    bootedbear

    Joined:
    Sep 13, 2004
    Location:
    Austin, TX
    #6
    Yeah, really. C?

    One of PHP or Java is much more customary.
     
  7. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #7
    Why not? C would work just fine.

    The term "back end" means software that runs on the server so you write that software in C. If that program runs as a gci-bin then whatever it writes to standard output goes directly to the user's browser. But it is really odd that your server has only a Compiler and not even Perl.

    The term "front end" means software that runs on the end user's browser. I think for that your options are only Javascrit and Java unless you want to force your users to download a browser plug in.
     
  8. bootedbear macrumors 6502

    bootedbear

    Joined:
    Sep 13, 2004
    Location:
    Austin, TX
    #8
    But with C one is forced into using the antiquated and inefficient CGI interface. Not scalable, and not very extensible either.

    If one is going to get into programming a backend, the scripting approach of PHP, or the programatic approach of Java are the best alternatives. And no, don't confuse server-side Java with client-side applets. They're not even remotely related.
     
  9. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #9
    Ditto as to ChrisA's excellent response and advice.

    Since this is an usual situation, I suggest unusual advice to the OP, copy/pasted from various Google search results I found:

    Just a different set of approaches to research on your own. Personally, I'd drop your webhost if they're the one forcing C on you and they don't support Perl or Java on the server side. But if you code is C based and either you don't know how to port to Perl (perl_mod) or Java (compiled from the SDK) or PHP (Apache DSO, optional Zend compiler) and or your client demands you use it then consider the above advice, but you're on your own as to seeking support. It's kind of like asking a modern car mechanic to fix a broken engine on a model T in terms of web application development standards of today (not desktop or CLI application coding in general where C is still used of course). Yeah, I know, I hate it too when stupid car analogies are used in web stuff. But it gets the point across here!!!!

    -jim
     
  10. Aea macrumors 6502a

    Aea

    Joined:
    May 23, 2007
    Location:
    Denver, Colorado
    #10
    A Backend in C seems like a rather odd idea. The web is all about fast development, scalable deployment, and being fast enough.

    C will crash and burn on everything except for the last one, as it's typically 2-3 x faster then PHP. With Java and Perl the speed benefit is even lower. Sure some websites might use a little bit of C code sprinkled in (PHP Plugins?), or for handling more complicated server/client interactions, but in general they're going to be using PHP/Java/Perl/Python/Ruby. C is fast, but it's a pain to develop for, and I'm not even sure if there's any frameworks for web uses, althougH I assume you could write an Apache Module.
     
  11. zoomvroom89 thread starter macrumors newbie

    Joined:
    Aug 29, 2008
    #11
    I was mainly looking to integrate libpurple into my existing web application. I guess I should just create my own Apache module.
     
  12. mari0 macrumors member

    Joined:
    Sep 10, 2007
    #12
    To be honest mate, PHP would be all you would need along with Javascript and CSS and MySQL. PHP is one of the most popular web coding languages.

    PHP can create incredibly dynamic websites and many employers look for people with PHP experience. Also PHP can be easily read by many other people as so many people know it. There are also more servers that would support a PHP back end. As PHP is open source and popular there is also lots of support.

    One that I use is www.one.com.
     
  13. detz macrumors 65816

    Joined:
    Jun 29, 2007
    #13
    Google's back-end is mostly C with some Python. Use what ever language is right for the job, we use C/++, Python, Perl, PHP for our backends.
     
  14. zoomvroom89 thread starter macrumors newbie

    Joined:
    Aug 29, 2008
    #14
    And you use a custom Apache Module?
     
  15. montanachad macrumors regular

    montanachad

    Joined:
    Jul 7, 2008
    Location:
    Helena, Montana and Lacey, Washington
    #15
    I've heard of #C being used in Web development (like .Net), but not C.:confused:
     
  16. jaikob macrumors 6502

    jaikob

    Joined:
    Jul 1, 2008
    Location:
    Freeland, MI
    #16
    The world of server side scripting.

    In theory I guess it is possible.

    try it? we aren't stopping you.
     
  17. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #17
    There is no reason you can't use C in the back end. I've done it and I'm doing it right now. It depends on what you need to do on the back. In my case it's a bunch of number crunching and database thrashing. Actully I've got a mix or Perl and C.

    The waycgi bin scripts work is they just write to "standard out" and whatever they write is sent out to the user. why can't a C pergram write to stdout?
     
  18. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #18
    I would do the module only if your site has enough traffic that performance becomes an issue. The reason you go with a module is to eliminate the overhead of process startup. But it the site is only getting a few hits per minute you are not going to have to worry about loading up a server.
     
  19. Palad1 macrumors 6502a

    Palad1

    Joined:
    Feb 24, 2004
    Location:
    London, UK
    #19
    These are the Common Gateway Interfaces belonging to your father.
    An elegant set of environment variables and stdout, for a more eleg... Scratch that. Long live RoR!:p
     
  20. saltyzoo macrumors 65816

    saltyzoo

    Joined:
    Oct 4, 2007
  21. zoomvroom89 thread starter macrumors newbie

    Joined:
    Aug 29, 2008
    #21
    Thanks for all your responses.

    So it seems like there are two (3?) ways to approach this:

    1) Write a PHP extension
    2) Make an Apache module (fastest)
    3) Make a C program that writes to stdout?

    Thanks for all your help!
     

Share This Page