Jump to content


Photo

exec() wont run windows programs


  • Please log in to reply
4 replies to this topic

#1 mlat

mlat
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 20 September 2006 - 08:38 PM

I'm having trouble with the exec command (its a vps windows server). I use the code exec("start /b \"C:\path_to\program.exe\"");

I run 3 command line programs using that same piece of code, and it seems to work perfectly fine. When I get to a normal windows program I have to run, it wont run. I even tried a bat file but that doesn't work either. The php script just is stuck at load unless I take that program out. Any suggestions?

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 21 September 2006 - 06:33 AM

Is it throwing out any errors or other output if you include the output attribute?
<?php
exec("start /b \"C:\path\to\file.exe\"",$out);
echo "<pre>",print_r($out),"</pre>";
?>


#3 mlat

mlat
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 21 September 2006 - 08:34 PM

No, it literally freezes right when it gets to exec. I've tried other combinations and other functions, it just seems whenever I attempt to run that program with php, it doesn't work.

#4 SephirGaine

SephirGaine
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 21 September 2006 - 08:37 PM

Unfortunately I'm not sure what's exactly wrong, but just for troubleshooting goodness, try with a different browser. If that doesn't work, try running the script on a different machine entirely. I'm sure it'll be easier to pin down what the problem is if you can figure out whether it's a problem with the code itself or a system/security/firewall problem. I can imagine a lot of things can prohibit programs from running remotely off of a script.

#5 mlat

mlat
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 21 September 2006 - 08:46 PM

Well, I'll tell you what I know.

I can't run this program on any other server besides the one I have and my own computer. It works on my own computer, and the program works fine when i run it myself on the server. However, whenever I try to run it by script from the server, either by local host or accessing it from my own computer, it doesn't work. I have even tried to run a bat file which runs that program. No success.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users