icemetalpunk
New member
I'm trying to use PHP's exec() function to run a program on my server (specifically, it's a program that converts .doc files--which can be uploaded--into HTML files). However, no matter how I try to do this, it never works.
I've tried exec(), system(), passthru(), even process creation with popen(). They all work fine for built-in system commands--like ping, echo, etc.--but when I try to run any non-standard EXE's, it doesn't work. I get an empty return value and the program is never executed server-side.
After some research, I've given cmd.exe Read/Execute access for all groups, specifically IUSR. I've also set the Apache service properties to allow it to "Interact with the desktop". Nothing helped.
I'm using WAMPServer 2 with PHP 5.3.4 and Apache 2.2.17 on a Windows 7 Home Premium 64-bit system.
Can someone please help? I need to be able to convert .doc files for my site, and I can't do that if I can't run EXE's from PHP.
@Mr. Klaus: Yes. I first tried it with a full path. No dice. So then I added the program's path to my PATH environment variable so I could just call it by name. Still didn't work. I've tried every combination of quotes and no quotes, escaped slashes and non-escaped slashes. No matter what I try, it just doesn't work if I'm calling anything other than built-in Windows programs.
By the way, the commands work fine when called from a command prompt, but the copied-and-pasted identical commands don't work from PHP.
@Unca Alby: I'm escaping them just as you are in the example, by doubling all backslashes, And like I said, I've tried every combination of quotes and no-quotes, and nothing works. I've set the permissions for cmd.exe, giving IUSR Read/Execute access like everything online says I need to. And I got all my solutions from the php.net EXEC manual comments; none of them work. I'm getting really frustrated since the conversion functionality is crucial to my site, and I can't make it work without executing programs from PHP.
I've tried exec(), system(), passthru(), even process creation with popen(). They all work fine for built-in system commands--like ping, echo, etc.--but when I try to run any non-standard EXE's, it doesn't work. I get an empty return value and the program is never executed server-side.
After some research, I've given cmd.exe Read/Execute access for all groups, specifically IUSR. I've also set the Apache service properties to allow it to "Interact with the desktop". Nothing helped.
I'm using WAMPServer 2 with PHP 5.3.4 and Apache 2.2.17 on a Windows 7 Home Premium 64-bit system.
Can someone please help? I need to be able to convert .doc files for my site, and I can't do that if I can't run EXE's from PHP.
@Mr. Klaus: Yes. I first tried it with a full path. No dice. So then I added the program's path to my PATH environment variable so I could just call it by name. Still didn't work. I've tried every combination of quotes and no quotes, escaped slashes and non-escaped slashes. No matter what I try, it just doesn't work if I'm calling anything other than built-in Windows programs.
By the way, the commands work fine when called from a command prompt, but the copied-and-pasted identical commands don't work from PHP.
@Unca Alby: I'm escaping them just as you are in the example, by doubling all backslashes, And like I said, I've tried every combination of quotes and no-quotes, and nothing works. I've set the permissions for cmd.exe, giving IUSR Read/Execute access like everything online says I need to. And I got all my solutions from the php.net EXEC manual comments; none of them work. I'm getting really frustrated since the conversion functionality is crucial to my site, and I can't make it work without executing programs from PHP.