exec() sometimes works sometimes not

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
php_ghost
Forum Commoner
Posts: 55
Joined: Thu Jan 11, 2007 3:29 am

exec() sometimes works sometimes not

Post by php_ghost »

Code: Select all

 
exec("gunzip $filename");
exec("rm -f $filename");
 
Here are two lines of codes from my script. the second line is consistent. It successfully deletes the file contained in $filename meaning, exec works fine and $filename contains a valid filename. However the first line (one with gunzip) sometimes works sometimes it doesn't. Anyone encountered this weird problem? TIA

-archie
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: exec() sometimes works sometimes not

Post by Christopher »

What user creates the zip file? It is probably a permission problem.
(#10850)
php_ghost
Forum Commoner
Posts: 55
Joined: Thu Jan 11, 2007 3:29 am

Re: exec() sometimes works sometimes not

Post by php_ghost »

arborint wrote:What user creates the zip file? It is probably a permission problem.
the zip file is created in the same script using this code:

Code: Select all

   exec("mysqldump --host=$db_host --user=$db_user --password=$db_pass $db_name | gzip -9  > $filename.sql.gz ");
php_ghost
Forum Commoner
Posts: 55
Joined: Thu Jan 11, 2007 3:29 am

Re: exec() sometimes works sometimes not

Post by php_ghost »

up
Post Reply