Is it perfectly legal in PHP to execute more than one command in an external shell call?
I have a command line:
/usr/bin/zip -r "../archives/myHPEportfolio-2002_2003Backup" /home/Mike/mynhsappraisal/documents/3/32/2002_2003/* -x \*.html
Which fails when run from within PHP (no error/result given) but runs fine from a Bash session.
I even put the full path to the 'zip' command as suggested in another thread.
I've tried the following ways to run my PHP code:
$cmd = "cd $userarea" . $d['archiveyear'] .";";
$cmd .= "/usr/bin/zip -r \"../archives/" . $g_ps['core']['productname'] . "-" . $d['archiveyear'] . "Backup\" * -x \*.html";
//$res = `$cmd`;
exec($cmd, $res, $retval);
//$res = shell_exec($cmd);
//system($cmd, $res);
ignore_user_abort(false);
Obviously i've commented out each that i've tried, so that I can try the next.
Anybody got any ideas how to solve this annoying problem? Maybe it is not possible to do two command (the 'cd', and 'zip') in a single PHP shell execute? But then if i did a 'cd' in one call and the 'zip' call in another - would the change of directory apply for the next external command I executed?