I'm trying to use an .exe file to perform calculations and pass the output into PHP. I made a Hello World .exe file using C++, but I can't get PHP to execute it.
If I run this command from the CMD, I get the correct output:
C:\path\file.exe
But if I do this in PHP, the output is an empty string:
exec('C:\path\file.exe',$out);
var_dump($out);
But this displays the correct output:
exec('ipconfig',$out);
var_dump($out);
I'm using WAMP on Windows 7.
Edit: Here is the C++ program:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World" << endl;
return 0;
}
Few advices that may help:
/
instead, it also work under windows.$exec = '"C:/my path/file.exe"';
$exec = '"C:/my path/file.exe" /help';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With