Web Hosting Talk







View Full Version : PHP Controlling Windows 2k


KelteN
08-24-2002, 11:30 PM
How would I create a php script that would be able to run certian commands on my windows 2000 server, all from a web interface control panel??? I know this is a tuf questions, but I just thought I would give it a try. ;)

sitekeeper
08-24-2002, 11:40 PM
First you should download and install phpdev5 from http://www.firepages.com.au/ you will then have the ability to learn and test php on you PC. I have been using version 4 for about 4 months and ver. 5 for about 1 month. I found it is very stable and compatible.

Beta 5 worked as soon as it was installed no problem, it includes:
apache 1.3.26
apache 2.0.39
php4.2.2
MySQL4
phpmyadmin 2.3 (RC)
AnalogX php.ini configurator
PHP-GTK 0.51
PhpWebsite

KelteN
08-25-2002, 12:14 AM
K i just installed it :)

AlCapone_yg
08-25-2002, 01:48 AM
.. and then just use any of the system calls (http://www.php.net/manual/en/ref.exec.php)

KelteN
08-26-2002, 03:04 PM
OK, can you give me an example of a script that would execute "test.exe -text test +exec test.cfg" & be able to shut it down with a seperate command.

terrastudios
08-26-2002, 05:20 PM
<?php
system("the command you wanted to run");
?>

as for the closing it, cant think of a easy way of doing this under windows, been using linux to much. ud need to grab the process id and kill it

sorry cant be much more of a help

CagedTornado
08-27-2002, 08:58 AM
To be able to control aspects of Windows, you would need to make sure that the IIS user (normally 'the IIS anonymous user') has sufficient permission to execute various programs. This gets more complicated on a domain (if you wanted to automate DB creation on another box, for example) because this user must be a domain user.

Just something to keep in mind.

Dan

Ahmad
08-27-2002, 09:53 AM
Try this function:

http://www.php.net/manual/en/function.popen.php

combs
08-27-2002, 01:28 PM
Try System() function call.

system() is just like the C version of the function in that it executes the given command and outputs the result. If a variable is provided as the second argument, then the return status code of the executed command will be written to this variable.