Re: Different behaviour : command line / cron
| From: | Miguel J. Jiménez | Date: | Wed, 18 Apr 2007 08:33:31 +0000 |
| Subject: | Re: Different behaviour : command line / cron | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253182@lists.php.net to get a copy of this message | ||
mbneto escribió:
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@foo.com", "fax", $cmd."\n".system($cmd)); ... The output from the command line (/usr/bin/php /path/to/file/script.php) /usr/bin/sendfax -n -d fax_number /tmp/fax.txt request id is 471 (group id 471) for host localhost (1 file) The output when it executed from cron (*/1 * * * * /usr/bin/php /path/to/file/script.php) /usr/bin/sendfax -n -d fax_number /tmp/fax.txt In both cases the fax.txt has the same content. Any idea why and how to solve it? Try deactivate php_gtk extension in PHP-CLI if you have it loaded... I had the same problem you describe and while googling I found about this solution and worked fine.-- Miguel J. Jiménez Programador Senior Área de Internet/XSL/PHP migueljose.jimenez@isotrol.com ---------------------------------------------------- ISOTROL Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta. Parque Tecnológico Cartuja '93, 41092 Sevilla. Teléfono: 955 036 800 - Fax: 955 036 849 http://www.isotrol.com "You let a political fight come between you and your best friend you have in all the world. Do you realize how foolish that is? How ominous? How can this country survive if friends can't rise above the quarrel". Constance Hazard, North & South (book I)