Page 1 of 1

Unable to execute some windows commands

Posted: Fri Dec 24, 2010 5:21 am
by v2kish
Hi forum ,

I trying to execute commands using php. for example using the following code i am renaming a file

echo exec("ren cfile.php cfile.txt");

while i try to execute this code in my windows server it doesn't work , i test the same code in my localhost (local machine) its working fine and able to rename the file.
when i try with another command like " echo exec("tasklist"); " it working as like in the localsystem .
So please suggest me why i am unable to rename on my windows server.

thanking you in advance

Re: Unable to execute some windows commands

Posted: Mon Dec 27, 2010 9:29 am
by thecodewall
Php is a server side language, all processes includes making and modifying files are done in sever side.
You mention that its actually running in localhost, localhost is the server machine, its suppose to work in your windows server. I think you check the permission, if you allow to modify files

Re: Unable to execute some windows commands

Posted: Mon Dec 27, 2010 9:58 am
by Bind
v2kish wrote:Hi forum ,

I trying to execute commands using php. for example using the following code i am renaming a file

echo exec("ren cfile.php cfile.txt");

while i try to execute this code in my windows server it doesn't work , i test the same code in my localhost (local machine) its working fine and able to rename the file.
when i try with another command like " echo exec("tasklist"); " it working as like in the localsystem .
So please suggest me why i am unable to rename on my windows server.

thanking you in advance
if you uploaded to an account with a shared host, some php functions may be disabled for security reasons. Check your phpinfo() for 'disable_functions' in the 'Configutation PHP Core' section. to make sure.