PHP: Why isn't exec() returning output?
You should redirect stderr to stdout.
To do that, change your exec() call like this:
exec("ping -c 1 $domain_bad 2>&1", $output, $return_var);
More info about 2>&1
meaning here.
If the answer above could not solve your problem, maybe exec()
is disabled. You can try to check php.ini
file at disable_functions
line.