linux - How to compile and run c program using exec command in php? -
when run
<?php echo exec('whoami'); ?>
it works fine, other single word command
but exec('gcc -o hello.c');
not create object file a.
or when try exec('./a');
precreated object file, not make change. no error no notification!
any appreciable!
basic reference:
exec()
manual page- bash redirections (applies other shells)
with elements, it's straightforward obtain error messages:
<?php exec('gcc -o hello.c 2>&1', $output, $return_value); echo ($return_value == 0 ? 'ok' : 'error: status code ' . $return_value) . php_eol; echo 'output: ' . php_eol . implode(php_eol, $output);
e.g., in (windows) computer:
error: status code 1 output: "gcc" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.
Comments
Post a Comment