How can you build a site like http://ideone.com/ which will compile/run like 40 different languages? I don’t need 40 language support but would like to be able to run PHP and possibly a couple others on a personal pastebin project, any help appreciated on how to accomplish this
How can you build a site like http://ideone.com/ which will compile/run like 40 different
Share
For compiled languages, you would have to write something to invoke a [probably command-line] compiler sitting on the web-server, feeding it the user input source. For PHP, you can execute code using
eval(), but it’s probably safer (and certainly more portable) to invoke the PHP interpreter instead.Of course, executing arbitrary user-input source code poses serious security risks, so I imagine http://ideone.com/ executes the resulting binaries in some sort of sandbox.
I wouldn’t recommend using
eval()on user input unless you have configured your web server to severely restrict PHP, and have some sort of third-party library (don’t reinvent the wheel) for identifying malicious code.