0

Using exec(), I am trying to run a php script that does a calculation but it doesn't seem to be running. I have confirmed permissions are set (tested with exex('whoami')).

CODE

echo exec('C:\wamp\www\module_calc>php calc.php "add" "1" "5"');

UPDATE: Escaping the \ has not worked either

UPDATE: This worked

exec('cd "C:\wamp\www\\module_calc" && php calc.php "add" "1" "5"');
user3682205
  • 241
  • 4
  • 16

1 Answers1

0

See how you run a php-script via exec: PHP exec to run a file

Better practice is to include and then call function:

include "C:\wamp\www\module_calc\calc.php";
add(1, 5);
Community
  • 1
  • 1
Alexis Peters
  • 1,583
  • 1
  • 10
  • 17