This example demonstrates using the 'exec' function in PHP, to execute simple shell commands, such as 'uptime'.
There are many other ways to execute programs via PHP, and many other programs I could have used as an example, but this example should be pretty straight-forward.
$cmd = 'uptime';
$results = exec(escapeshellcmd($cmd));
Here I use the 'escapeshellcmd' command to ensure that no arbitrary commands are being executed by the 'exec' function, which is what is actually executing the command.
This is most significantly important if you're executing a command that may contain user-input data via HTTP Request, or something.
12:24:12 up 248 days, 12:09, 29 users, load average: 0.00, 0.00, 0.00