I want to run a executable file from my php script and the command used in the command line is
where, profit is the executable file and profit.in is the input file. I wrote the following php script for running The same program when ran in the command prompt
I want to run a executable file from my php script and the command
Share
exec doesn’t return the result to
$profit, try it this way:Also make sure that the path to your parameter file is correct, best use an absolute path if it’s not being generated by your script.
Notes
Since your
execcalls leads me to believe you’re working on a windows box, the path separator is a backslash, which you should escape, too:is what it should look like, imo.
A second possible issue just came to mind: you’re using xampp, on a windows machine. If you’re running this script from the command line, make sure you’re using the right exe:
php-cli.exe, instead of thephp.exe: