As others have noted, shell_exec and the backtick operator (`) both return NULL if the executed command doesn't output anything.
This can be worked around by doing anything like the following:
shell_exec ("silentcmd && echo ' '");
Here we're simply outputting blank whitespace if the command succeeds - which satisfies this slightly strange issue. From there, you can trim() the command output etc.