V
V
vista1x2014-10-01 23:03:27
linux
vista1x, 2014-10-01 23:03:27

How to compile files on the server?

Hello!
I was faced with the task of compiling pascal / c ++ sources on a linux server using PHP. In this case, you need to somehow "enter" the data that the program can request. Google didn't turn up anything useful.
There is a system() function that executes an exe file - but I need something a little different. Is it possible to compile the source code and display the result using this function + the fpc compiler? If so, is the compiler suitable for win? And is it possible to "enter" the data?
I would appreciate useful links. Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
m0rd, 2014-10-01
@m0rd

Win compiler will not work. What data are you going to enter?
Throw the source on the server, and then php.net/manual/ru/function.exec.php specify the correct arguments for the compiler and see the output.

S
Sergei Borisov, 2014-10-02
@risik

Regarding data entry, in my opinion, a good solution was made in ideone.com
, that is, the user first enters all the data that he will have to enter, and then they are transferred to the program. If you want the user to enter data exactly at the moment when, for example, the program issued an invitation to enter them, then you have to work.

G
Gasoid, 2014-10-02
@Gasoid

firstly, you need to install the pascal compiler on a Linux server, I'm afraid that you have a regular shared hosting, where this cannot be done.
secondly, the compiled program in Linux on windows will not work, this must be remembered.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question