0

I want to create a c++ compiler on my website using php. How do I do that? Pls help. thank you

Edited by jeffersonalomia

3
Contributors
12
Replies
36
Views
2 Years
Discussion Span
Last Post by diafol
Featured Replies
  • 1
    diafol 3,720   2 Years Ago

    Erm. You sure you really want to do that? Not saying it can't be done, but not sure if PHP is the right tool for the job. Giving me a nosebleed just thinking about it. Most compilers I know of use C/C++. That's for a good reason. An oft-cited issue … Read More

1

Erm. You sure you really want to do that? Not saying it can't be done, but not sure if PHP is the right tool for the job. Giving me a nosebleed just thinking about it. Most compilers I know of use C/C++. That's for a good reason. An oft-cited issue against PHP is using strings for binary arithmetic. Why do you need to do this - or more correctly, why does it need to be in PHP?

0

jeffersonalomia ,
I hope you know that PHP can execute an external program. That way you can save the original C++ code in a file , and run the C++ compiler with arguments the file.
@see http://php.net/manual/en/function.exec.php

But ... as Diafol wrote , why in earth , do you want to do such thing?

0

thanks for your response jkon and diafol. i wanted to do this because of my thesis, which is about E-Learning on c++. And I want to make the users have the ability to code on the website that i have developing about E-Learning c++.

Edited by jeffersonalomia

0

May I have your suggestions as an alternative features that i can include on my E-Learning. I will appreciate all your response. Thanks

0

May I have your suggestions as an alternative features that i can include on my E-Learning. I will appreciate all your response. Thanks

I have no idea what this means. Are you struggling for ideas for your thesis? As jkon says, you can use PHP to run executables - a compiler even? So it would, AFAIK do what you want. Are you looking to create "an online C++ compiler"?

0

My thesis is about E-Learning System and somehow I want to use that compiler as a feature on my ELS to make the user apply what they`ve learn on my E Learning System

Edited by jeffersonalomia

0

Im confuse with this note from http://php.net/manual/en/function.exec.php

If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.

Do I need to create a c++ file and write the inputted code inside that cpp file?

Edited by jeffersonalomia

0

Having you read the php manual on exec() as jkon suggested? I'm not sure what more I could add to that.

You access the compiler (which would be an .exe file) as per the examples and in the link which I included.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.