Re: Issues with exec()/system()

From: Date: Wed, 10 Sep 2003 16:21:14 +0000
Subject: Re: Issues with exec()/system()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162192@lists.php.net to get a copy of this message
* Thus wrote Tom Ray [List] (lists@blazestudios.com): > I'm having a bit of an issue using exec() and system(). hmm.. seems to be the theme today :) > > $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: This depends, if safe_mode is on, tar may or may not be allowed depending on the safe_mode settings. Also, tar may not be in your path, try calling tar directly: /usr/bin/tar [options] > $dir="unique_dir"; > $cmd="tar -cf /location/of/tar/files/$dir.tar /location/of/forum/diretory/*"; > exec($cmd); Just a side note, you might want to issue a: tar -czf /location/of/tar/files/$dir.tgz Probably will samve some space down the line. > > This should work shouldn't? Any thoughts, suggestions? Anyone else done something like > this? Yes, another thing to check for would be any error's that are issued from the exec($cmd). Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#162192) next »