Jump to content

Recommended Posts

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,

Link to comment
https://forums.phpfreaks.com/topic/274878-exec/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/274878-exec/#findComment-1414558
Share on other sites

  • 1 month later...

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.

Link to comment
https://forums.phpfreaks.com/topic/274878-exec/#findComment-1420695
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.