I'm trying to make a module in Drupal which utilizes exec(). The script runs fine if I load it manually in the browser or when I run it as su -l www-data, but when run by Drupal as a module the exec function doesn't run. I'm wondering how I can get more data out of this to better debug, or if anyone might know why Drupal won't let the exec run.
When loaded by Drupal, the entire script does execute without giving me any warnings or errors, which I find weird. If I add an or die('could not exec'); after the exec(), when I load my drupal page it does show me just "could not exec" and nothing else.
Any ideas? Thanks!
[EDIT]
I got this to working by specifying the explicit path of the php file I'm trying to exec. That is, I changed:
exec('php mymodule.helper',$output);
to
exec('php /var/www/mydrupal/modules/mymodule/mymodule.helper',$output);
[EDIT2]
Actually, I changed it now to:
exec ('php ' . __DIR__ . '/mymodule.helper',$output);
Which works perfectly.
exec('php mymodule.helper',$output);