To launch an external program, use the exec function.
Description
exec — Executes an external program
Syntax
Code:
string exec (string $command [, array &$output [, int &$return_var]])
where,
command: The command that will be executed.
output: If the output argument is present, then the specified array will be filled with every line of output from the command.
return_var: If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable.
Example
PHP Code:
<?php
echo exec('whoami');
?>
This gives the username that owns the running php/httpd process
Bookmarks