By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,277 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,277 IT Pros & Developers. It's quick & easy.

exec() function doesn't work for me

100+
P: 103
I'm trying to get exec() to work. It's a completely backend system so no security concerns.

I want a button in my page to launch a programme on my windows system (for example notepad.exe) really just to save me some time. So I tried the following to test this :

Expand|Select|Wrap|Line Numbers
  1. $cmd='notepad.exe'
  2. exec($cmd);
  3.  
After I run this script, nothing happens! But when I look at the process list on the windows task manager, I can see a new process - notepad.exe running. This process incidentally cannot be forced to quit without a restart.

Can anyone shed any light?

My system is: win2k pro, apache 2, php 5.2

Thanks!
Jul 19 '07 #1
Share this Question
Share on Google+
3 Replies


100+
P: 103

Expand|Select|Wrap|Line Numbers
  1. $cmd='notepad.exe'
  2. exec($cmd);
  3.  
Sorry - typo:


Expand|Select|Wrap|Line Numbers
  1. $cmd='notepad.exe';
  2. exec($cmd);
  3.  
Jul 19 '07 #2

mwasif
Expert 100+
P: 801
Why you want to run notepad via PHP?
Jul 19 '07 #3

100+
P: 103
It's an example. I am trying to get the function to work and notepad seemed a suitable guinea pig.

Once I have it working I'll write some .bat files which will launch other stuff and run some things (hopefully).

I think the issue could be related to the setup of PHP or the OS? But I'm really on unsure ground when it comes to this.
Jul 19 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.