1

I am invoking c/c++ from PHP using shell_exec(Server is httpd).

Is there any way where I can directly execute c/c++ executables from apache?

So the Apache will always execute only 1 executable each time (this file acts as a router). And then this executable will take care of the rest.

Thanks

Rahul
  • 1,403
  • 4
  • 18
  • 31

2 Answers2

3

You can execute it via Apache's CGI (or FastCGI) interface.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
1

I'm not sure I get your question correctly, but if you just want to execute a lot of system commands from your script, then it doesn't really matter who calls them - you still end up having to spawn new processes and pay the price for that. If you don't want to run the commands asynchronously, e.g. if you always need one result to proceed to the next step, then just keep using shell_exec.

Unless I'm misunderstanding and you are actually compiling C++ code from within your PHP script. That'd be something else.

Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084