Here’s how to run a shell script from your website. You’ll need 2 files.

Here’s the contents of foo.php. Wrap your output with ‘pre’ for better formatting.

<pre lang="php">
<?php $output = shell_exec('/var/www/html/bar.sh 2?>&1');
echo "$output";

Here’s the content of bar.sh. Output will be displayed on web page.

<pre lang="bash">
#!/bin/bash
now="$(date +'%y%m%d')"
echo $now
aws s3 ls