1

Can anyone tell me how I should approach the development of a web-based interface for remote compiling, based a compiler like InterviewStreet or Codeacademy for c, c++ ?

I want to develop the using PHP (Language doesn't matter anyway)

Is there any Opensource API for this kind of task?

Thanks

David W
  • 10,062
  • 34
  • 60
Manzur Husain
  • 185
  • 1
  • 4
  • 16
  • You can't be serious right? A compiler for C++ written in PHP??? You might as well ride a dead horse. – Tony The Lion Sep 14 '12 at 13:26
  • "please consider adding a comment if you think this post can be improved" Well I considered it. –  Sep 14 '12 at 13:27
  • 1
    He obviously means a web interface to do remote compiling: you post your c++ code, the Server compiles and runs it and outputs the result on the web page. This is very common – Bgi Sep 14 '12 at 13:27
  • 1
    @TonyTheLion It would be nice to have a c++ compiler in javascript. – sehe Sep 14 '12 at 13:27
  • @TonyTheLion Please check website i mentioned for your reference – Manzur Husain Sep 14 '12 at 13:32

1 Answers1

2

You could use shell_exec() and gcc.

I.e. basically compile from command-line with the usual compilers (g++, javac among others).

Always be careful of the security though, restrict the rights of the user compiling and running the compiled programs.

Bgi
  • 2,513
  • 13
  • 12
  • 3
    Please add a comment when downvoting. This could be done, but should be done carefully taking care of security – Bgi Sep 14 '12 at 13:28
  • 1
    +1 to counter unexplained anonymous downvotes. – Cheers and hth. - Alf Sep 14 '12 at 13:31
  • @Bgi Thanks Can you explain in brief what would be the architecture if want to make site like TopCoder, CodeAcademy or Interview Street ? – Manzur Husain Sep 14 '12 at 13:38
  • I can't really tell you, I'm no expert about that. But when doing that you must keep in mind everything a hacker could try to make your server crash or to hack it. – Bgi Sep 14 '12 at 13:46