Issues with exec()/system()
| From: | Tom Ray [List] | Date: | Wed, 10 Sep 2003 15:51:18 +0000 |
| Subject: | Issues with exec()/system() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-162182@lists.php.net to get a copy of this message | ||
I'm having a bit of an issue using exec() and system().
Background:
I have this script that installs forum software for a client, and that works like a champ. In it I
use system() to copy
the the default forum directory to the specified location the client sets, along with a unique
directory name for the
forum. The code looks like:
$dir="unique_dir";
system("cp -R forum /path/of/forum/location/of/forums/".escapeshellarg($dir));
The forum directory is located in the same directory as the script.
Now, this is where I run into trouble. When they delete directories, I want to backup the directory
before I delete it
just in case they delete the wrong information. I just can't get it to work. I've tried
exec() and system() to no avail.
Of course, I'm under the impression I can use tar via exec(). Currently I have:
$dir="unique_dir";
$cmd="tar -cf /location/of/tar/files/$dir.tar /location/of/forum/diretory/*";
exec($cmd);
This should work shouldn't? Any thoughts, suggestions? Anyone else done something like this?
TIA
Tom