I want to call a C++ program from PHP with apache server on Fedora 12 linux.
I see the output of exec('ls -lrt') but not exec("testprog").
testprog is put in the same directory of the test php program.
Please help.
The following are my php and cpp test programs.
Code:
<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
<?php
echo exec('ls -lrt');
echo exec("testprog");
?>
 </body>
</html>
testprog.cpp
Code:
#include <iostream>
#include <algorithm>

int main() {
  int array[] = { 23, 5, -10, 0, 0, 321, 1, 2, 99, 30 };
  int elements = sizeof(array) / sizeof(array[0]); 
  std::sort(array, array + elements);
  for (int i = 0; i < elements; ++i) 
     std::cout << array[i] << ' ';
}