I have tried to use exec()
with 'whoami'
to check if it works and I got the result of
nt authority\system
Now I need to run a .exe
file with parameters from php
via exec()
function.
I tried this in command prompt and it actually runs the program with given parameters. This is the example command.
NOTE the exe file gets 3 inputs (folder, file_name, report_file_nmae)
> ..\..\some_file.exe folder="C:\path_to_folder" param=1.xml report=2.xml
But when I run this command from php
file:
exec('..\..\some_file.exe folder="C:\path_to_folder" param=1.xml report=2.xml');
nothing is happening. This is the first time I am using exec() function, so I am not familiar with its details. What is wrong?
I tried using:
\\
instead of \
escapeshellarg()
on the directory""
around directory folder namesNo luck
Addendum:
echo exec($command) // echos < .... why?
or
exec($command, $output);
print_r($output); // Array()
I even changed the permission on the file to full control to all users.
If I call the program from command prompt
, I can see the icon appearing next to clock for a second.
But the same call from php
will not even call the program.
Edit
Even exec('notepad.exe');
is not working. Something has to be done with php
configurations maybe?
You might also try giving the full path to the binary you're trying to run. That solved my problem when trying to use ImageMagick
.
Source: Stackoverflow.com