I have a php script that's running fine by itself. I'm trying to turn it into a drupal module, and it seems that the exec function is not working. To test it I have a dummy script that just runs static data through the .exe file from within the .tpl.php file and displays the output, irrespective of the functionality of the module. The .exe is in the same directory as the module. Works fine outside of Drupal, but in Drupal the exec function returns an empty array. Since I'm new to Drupal, I wanted to ask: is there a fundamental reason why this can't work in Drup? The .exe permissions are set to 777.

Thanks.

Comments

wuf31’s picture

Just need to call it with the right path, i suppose..

try exec('/sites/all/modules/custom/custom.exe');

EtradingGallery

-=- Jhon -=-

criznach’s picture

Check out the documentation for exec. It might be slightly more complicated to run an exe...

http://us3.php.net/function.exec

papile’s picture

If you are on shared hosting or did not modify your php.ini it is likely you have safemode on. Safemode will not allow you to run external binaries. try doing system or exec on the absolute path of that exe. while you are doing this check out your apache error log.