Re: Different behaviour : command line / cron

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



# mbneto@xxxxxxxxx / 2007-04-17 18:41:46 -0400:
> Hi,
> 
> 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@xxxxxxx", "fax", $cmd."\n".system($cmd));
> ...

try with

$cmd = sprintf(
    '/usr/bin/sendfax -n -d %s %s 2>&1',
    escapeshellarg($fax),
    escapeshellarg($file)
);
exec($cmd, $out, $rv);
$body = sprintf(
    "command: %s\nstatus: %d\noutput:\n%s\n",
    $cmd, $rv, implode("\n", $out)
);
mail("myemail@xxxxxxx", "fax", $body);


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux