Unable to execute some windows commands

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
v2kish
Forum Newbie
Posts: 1
Joined: Fri Dec 24, 2010 5:06 am

Unable to execute some windows commands

Post 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
thecodewall
Forum Commoner
Posts: 33
Joined: Sun Dec 26, 2010 8:37 am

Re: Unable to execute some windows commands

Post 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
Last edited by thecodewall on Tue Jan 04, 2011 11:24 pm, edited 1 time in total.
Bind
Forum Contributor
Posts: 102
Joined: Wed Feb 03, 2010 1:22 am

Re: Unable to execute some windows commands

Post 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.
Post Reply