Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have external program.exe inside my website that gets data from text file, process it and then output to another textfile.

Since apache uses www-data as user account, i manage to log in to terminal using www-data, configure it to execute program.exe and it worked. But when i run program.exe using php exec, it does not work.

I use 'whoami' to determine the user account on the job, it outputted www-data.

share|improve this question

closed as unclear what you're asking by Falcon Momot, mdpc, Ward, voretaq7 Aug 28 '13 at 15:30

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

When you say "it doesn't work" what do you mean. More information please. – Drew Khoury Aug 28 '13 at 2:31
Wait, you're running debian, and trying to run a windows-style .exe binary? That's not going to work. – EEAA Aug 28 '13 at 2:32
I created and place the path of program.exe in it. When i execute the in root terminal it worked. But when i place in php using shell_exec, only the echo part worked but not program.exe. Thanks for posting your comment. – Nehemiah Aug 28 '13 at 2:58
What is program.exe? Is it a proper linux binary? If so, you're going to want to remove the .exe extension, as it'll only serve to confuse things. Typically only windows binaries have that extension. Linux binaries don't need an extension at all, but if it makes you feel better, use something like .bin, or .run. – EEAA Aug 28 '13 at 3:07
I tried removing .exe but it won't simulate even in root terminal. – Nehemiah Aug 28 '13 at 3:16

To execute scripts/executeables within php you have to use shell_exec the right way (use single quotes)



Apart from that the extension .exe on linux is creepy ;)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.