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:

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

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -