Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   Execute Commands with Command Prompt (http://www.programmingforums.org/showthread.php?t=11065)

PhilBon Aug 13th, 2006 10:26 PM

Execute Commands with Command Prompt
 
I've been working on a way to add a whole bunch of users to windows server 03. I've made one PHP file that will create me a batch file to add the users but that requires me to also run the batch file. I remembered seeing something on php.net about executing commands. I've tried system() and exec() and I've been getting these errors: "Warning: system() [function.system]: unable to fork [echo hello] in c:\inetpub\wwwroot\test.php on line 7" and "Warning: exec() [function.exec]: Unable to fork [dir] in c:\Inetpub\wwwroot\test.php on line 4". I was wondering if anyone had any info on this.

Booooze Aug 13th, 2006 11:08 PM

http://ca3.php.net/manual/en/ref.exec.php
http://www.google.ca/search?hl=en&q=...G=Search&meta=

Check those links at search google if you haven't already found a source or tutorial, or something you can refer to. If you have found something that you are following, post the link, and post some of your code. I've never done what you are trying to do here, but I figure you will probably geta response, or responses faster(and a solution) if you post some code. :)

v0id Aug 14th, 2006 3:56 AM

I haven't tried it too, but I would think you could use the system. But you say it doesn't work, so I don't know?
:

system("some command", $var);
if($var)
    // Do something


Booooze Aug 14th, 2006 1:37 PM

Quote:

Originally Posted by v0id
I haven't tried it too, but I would think you could use the system. But you say it doesn't work, so I don't know?
:

system("some command", $var);
if($var)
    // Do something


Hence why I said maybe he should post the code? It's hard to diagnose a problem without it. Because it could be a error on his side.

v0id Aug 14th, 2006 2:50 PM

Of course, I just gave it a try, maybe he didn't do it in that way.

DaWei Aug 14th, 2006 3:12 PM

If the application doesn't bring the ability to set some variables to the outside world, you're going to have to do some very arcane things to affect them. Does that answer your question? If ifs and buts were candy and nuts, we'd all have a Merry Christmas. Same goes for voodoo and unfounded guesses/hope.

Booooze Aug 14th, 2006 3:28 PM

Quote:

Originally Posted by v0id
Of course, I just gave it a try, maybe he didn't do it in that way.

How would we know if he hasn't posted any code? It has something to do with exec, shell, or shell exec. He says hes tried shell and exec and it doesn't work. What I'm saying is that if you google the question, there are lots of results. If he is still having trouble, there may very well be something wrong with the code. Anyways, he ain't getting any anwsers unless he posts back:rolleyes: That is, unless he already figured it out.:p

v0id Aug 15th, 2006 2:47 AM

I know, as i said I just gave it a try, maybe it was it.
Quote:

Originally Posted by PhilBon
I've tried system() and exec() and I've been getting these errors: "Warning: system() [function.system]: unable to fork [echo hello] in c:\inetpub\wwwroot\test.php on line 7"

He tried system(), so I thinked it was maybe that.


All times are GMT -5. The time now is 12:47 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC