#### Archived

This topic is now archived and is closed to further replies.

# exec() wont run windows programs

## Recommended Posts

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?

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

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

×

• Chat

## Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.