Code: Select all
$output = shell_exec('ls -al');
echo '<pre>';
print_r($output);
echo '</pre>';However I'm writing a backup script, and I can't get it to tar from php. I'm using the following..
Code: Select all
$output = shell_exec('tar -cvf backup.tar /var/www/vhosts/mysite/httpdocs/');When I use system($cmd, $retval) ... $retval comes out as 2 which.. i don't know what that means.
I'm thinking the only difference between the non-working command and the working command is that tar is a program execution call whereas ls is a system call?
I'm the only user on a dedicated box so I should be able to get this working.