PHP.nl

shell_exec

shell_exec

Execute command via shell and return the complete output as a string

 **shell_exec** string $command

This function is identical to the . backtick operator

Opmerking: > On Windows, the underlying pipe is opened in text mode which can cause the function to fail for binary output. Consider to use instead for such cases. popen

commandThe command that will be executed.

A string containing the output from the executed command, false if the pipe cannot be established or null if an error occurs or the command produces no output.

Opmerking: > This function can return null both when an error occurs or the program produces no output. It is not possible to detect execution failures using this function. should be used when access to the program exit code is required. exec

An level error is generated when the pipe cannot be established. E_WARNING

Voorbeeld: A example

<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>

exec``escapeshellcmd