Ahchachacha Posted February 24, 2013 Share Posted February 24, 2013 my safemode is off if i understand what exec() does correctly it will run a program on the server, im just trying for something simple to get it to work if i use exec('c:\test.txt'); //this will just hang indefinatly until i press stop include('c:\test.txt'); //this will just print the text to the webpage echo exec('c:/windows/system32/cmd.exe'); //this doesnt open a command prompt but it also doesnt hang as im testing this from the server its self what i was hoping would happen is it would open the text file for me thanks for reading, Quote Link to comment https://forums.phpfreaks.com/topic/274878-exec/ Share on other sites More sharing options...
kicken Posted February 24, 2013 Share Posted February 24, 2013 exec('c:\test.txt'); //this will just hang indefinatly until i press stop A .txt file is not a program. You should be targeting a .exe file such as notepad.exe. You can pass a parameter to open the file if you want, eg: exec('C:\windows\notepad.exe c:\test.txt'); echo exec('c:/windows/system32/cmd.exe'); //this doesnt open a command prompt but it also doesnt hang If you have apache (or whatever server) running as a windows service, then by default it will not have the ability to access your desktop. This means that if you try and open a GUI program it will not appear on your desktop for you to interact with. I can't remember for sure what happens but I believe the service has it's own virtual desktop it would open up on. There is a way to allow the service to interact with the desktop, I do not remember the way to set it up though. A google search should be able to point you in the proper direction. Quote Link to comment https://forums.phpfreaks.com/topic/274878-exec/#findComment-1414558 Share on other sites More sharing options...
Ahchachacha Posted February 24, 2013 Author Share Posted February 24, 2013 thanks for the quick reply, prefect , all better now Quote Link to comment https://forums.phpfreaks.com/topic/274878-exec/#findComment-1414559 Share on other sites More sharing options...
bitmark Posted March 24, 2013 Share Posted March 24, 2013 Hello, let's continued... I have wamp on windows 7 and exec is not working. I followed the privileges ideas and i've tried this 1. Opened the administrative tool "Services"2. Right clicked on my service and had to select "properties"3. Then in the "Log On" tab, selected "Allow service to interact with desktop". it's not working still not working. All i'm trying to do is to play a movie with bsplayer. From cmd all works fine. I even create a URL Protocol, but. still not working. So please, help me out. Quote Link to comment https://forums.phpfreaks.com/topic/274878-exec/#findComment-1420695 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.