Forum Moderators: coopster

Message Too Old, No Replies

Running External Program Thru Shell Exec

         

singtome

10:17 pm on Feb 29, 2008 (gmt 0)

10+ Year Member



Hi all!
I have a dedicated windows server.
Everything is compiled as far as IIS, Mysql & php is concerned.
But, I have this problem: I call external program commands through php using shell_exec.
The thing is that php responds OK when it comes to 'dir' or 'cd', but, in another program,
not windows-native, there is no response.
The program is set up in the PATH, because, if I open a cmd shell, I can call it from everywhere and it works fine!
I have given full control permissions to IUSR for the external program I am trying to call as well as the cmd.exe.
Any ideas on why shell_exec is not working?

coopster

10:21 pm on Feb 29, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, singtome.

As long as you are able to run other commands I would say that safe_mode is not an issue. Have you checked your logs for error messages?

singtome

10:26 pm on Feb 29, 2008 (gmt 0)

10+ Year Member



Yes I am able to run other commands & I have also verified that safe_mode is OFF. There are no error messages being posted to the logs so I am at a loss as to what the problem is. Any help at all would be greatly appreciated!

coopster

11:01 pm on Feb 29, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Did you try using the full path to the executable, just to be certain that is not the issue?

singtome

3:17 am on Mar 1, 2008 (gmt 0)

10+ Year Member



Yes I have used the full path to the executable as well & that didnt work. Any other suggestions?

coopster

6:57 pm on Mar 1, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm running out of ideas too. It seems that it is still a permissions issue. What if you temporarily grant *ALL access (read/write/execute) to *ALL users (public) for the executable that you are trying to use. Then retry your script to see if there is still an issue.

singtome

9:50 pm on Mar 3, 2008 (gmt 0)

10+ Year Member



I have tried that as well & it did not work. But it continues to work thru command line of course.
I am running out of ideas as well.
Is there anything that I have to do maybe specific to php configuration to allow the execution of external apps thru shell_exec?

singtome

3:58 am on Mar 4, 2008 (gmt 0)

10+ Year Member



I think I know why its not working. This external program, when executed, briefly brings up a desktop window until execution completes. I think you are not able to call an external app thru php that requires another window to be displayed.