L
L
LittleFatNinja2015-08-28 23:01:35
linux
LittleFatNinja, 2015-08-28 23:01:35

Why is there no error output from the console when executing commands with PHP and how to compile a cpp file?

I check the directory var_dump(system('pwd'));
all the rules, the path outputs
I try to compile in this directory var_dump(system('g++ 1.cpp'));
does not compile + DOES NOT give errors, there is no output
string(0) ""
var_dump(system('kgfhkjfvjfk'));- the same without errors
string(0) ""
the same with the
shell_exec
exec
passthru commands
all files of the www-data user and rights 777 are
worth nginx on linux mint

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Defman21, 2015-08-30
@LittleFatNinja

Errors are not written to STDOUT, but to STDERR (I personally did not find a way to get STDERR after exec).
As a work-around, you can use this method:
exec('blablabla 2>&1');

K
Ken Jee, 2015-08-28
@Machez

Use the exec command with the output parameter

R
Ruslan Fedoseev, 2015-08-28
@martin74ua

enable error output in php.ini.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question