asmith Posted June 21, 2009 Share Posted June 21, 2009 Hi, On my pc, Windows XP OS, I run this : <?php exec('program.exe'); ?> It does nothing and shows a white page. I've checked my php.ini, Safe mod is off and error reporting is set to error_reporting = E_ALL & ~E_NOTICE Something obvious I'm missing? Quote Link to comment https://forums.phpfreaks.com/topic/163112-solved-exec-does-nothing/ Share on other sites More sharing options...
trq Posted June 21, 2009 Share Posted June 21, 2009 What exactly do you expect it to do? Quote Link to comment https://forums.phpfreaks.com/topic/163112-solved-exec-does-nothing/#findComment-860606 Share on other sites More sharing options...
asmith Posted June 21, 2009 Author Share Posted June 21, 2009 This command line works in the windows run : "e:\program.exe" "e:\test" /param10 It sends the folder test to the program.exe, program.exe converts files in the test folder. How do you do such command with php? The php script is in the same folder as the program. <?php exec('"program.exe" "test" /param10'); ?> It shows a white screen and don't work. I tried <?php exec('hexEditor.exe'); ?> just to see if it opens up the hexeditor being in the same folder. but it doesn't and still a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/163112-solved-exec-does-nothing/#findComment-860624 Share on other sites More sharing options...
trq Posted June 21, 2009 Share Posted June 21, 2009 Firstly, the programs aren't going to open any windows. Your server doesn't have permission to do that. As for your other problem. php has a limited path set usually, so you will need to supply the full path to your .exe file to exec. You might also try making use of exec()'s second and third arguments so you can at least try and get some feedback from your request. Quote Link to comment https://forums.phpfreaks.com/topic/163112-solved-exec-does-nothing/#findComment-860630 Share on other sites More sharing options...
asmith Posted June 21, 2009 Author Share Posted June 21, 2009 Thanks thorpe. I set the output variable I and tired few different way and finally got it working Quote Link to comment https://forums.phpfreaks.com/topic/163112-solved-exec-does-nothing/#findComment-860740 Share on other sites More sharing options...
RussellReal Posted June 21, 2009 Share Posted June 21, 2009 I find it also important to note, if you use exec in a php script which is executed thru the command line, you'll recieve the output in the cmd window, but if you want to use exec anywhere like on ur web server, you'd want to use backticks or like thorpe said, specify the output variable. backticks r ` ` which is shorthand for exec and returns the value $ping = `ping phpfreaks.com`; Quote Link to comment https://forums.phpfreaks.com/topic/163112-solved-exec-does-nothing/#findComment-860745 Share on other sites More sharing options...
asmith Posted June 25, 2009 Author Share Posted June 25, 2009 Good to know, Thanks Quote Link to comment https://forums.phpfreaks.com/topic/163112-solved-exec-does-nothing/#findComment-863456 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.