Re: Different behaviour : command line / cron

From: Date: Thu, 19 Apr 2007 04:51:41 +0000
Subject: Re: Different behaviour : command line / cron
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-253245@lists.php.net to get a copy of this message
On Tue, April 17, 2007 5:41 pm, mbneto wrote: > I've developed a simple script that among other things sends a fax > using > hylafax's sendfax program. If I test it calling directly from the > command > line it works fine. > > If I let it run from cron it executes everything fine except the fax. > > I am using the system call and in order to debug I am using the > following > code > > ... > $cmd = sprintf('/usr/bin/sendfax -n -d %s %s',$fax,$file) ; > mail ("myemail@foo.com", "fax", $cmd."\n".system($cmd)); Use exec() instead of system, and get the $error number, and use perror on the command line to find out what went wrong. cron runs in a different environment, and my first guess is that it doesn't have access to /tmp/fax.txt, but that's just a guess. You may also want to put quotes around "fax_number" in case it has spaces in it... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#253245) next »