...

View Full Version : Start, stop, and check process with PHP on windows



Dubz
04-18-2012, 12:58 AM
I'm wondering if anyone can help me get or make some functions in php to start a process, stop a process, and check if one is running (with the pid). I have one that works on linux, but I need it for windows. Thanks in advance!

Fou-Lu
04-18-2012, 01:17 AM
Do you mean like the tasklist (for which you can do all of the above, except start but that just requires an exec anyway), or the services?
You can probably do everything you need with the proc functionality of the exec library. You might want to check out the com and .net extensions as well, one of these probably allows you to connect via wmi if you wanted a larger variety of what you can do.


Hah even better!
http://ca3.php.net/manual/en/book.win32ps.php

tangoforce
04-18-2012, 02:18 AM
Going by Dubz's previous topics from memory, he's working on a php based bot system for IRC chat rooms. The bots are written in php and are supposed to cycle continuously doing their thing.

It certainly can be done, I have a working system like this however I use it for something different. I believe what Dubz is looking for is something like the windows service controller - where they can start and stop multiple php processes and leave them running like you can with a windows service.

Fou-Lu
04-18-2012, 03:05 AM
.NET or COM then is the way to go.
Why write this in PHP period? Why not just write a C/C++, C# or Java application to do this for you? PHP isn't really designed for administration or desktop level interaction, even PERL would pound the crap out of PHP in this aspect. Since PHP doesn't multithread well (although you can do tick heartbeats to execute specific commands), you'd be better of with one of the more robust languages just for the multithreading.

Dubz
04-18-2012, 04:49 AM
.NET or COM then is the way to go.
Why write this in PHP period? Why not just write a C/C++, C# or Java application to do this for you? PHP isn't really designed for administration or desktop level interaction, even PERL would pound the crap out of PHP in this aspect. Since PHP doesn't multithread well (although you can do tick heartbeats to execute specific commands), you'd be better of with one of the more robust languages just for the multithreading.

Well I started learning PHP as my first (bigger) language (I started as a noob with batch stuff) and I don't have any know;edge of much other languages besides some html/css and a little javascript. The bot that I'm working on (tats what this is for) is for a chat, but not IRC. It's for xat. I'm sure other languages would be better with this but I want to get it to run on a server type deal to save the space on my own machine and so I can let others use it too without releasing the source or any software. Xat is constantly updating stuff so I want to be able to have it up to date on the code. I'm sure I ould do automatic updates and such with other languages but I already have a lot of this done plus a bunch of earlier experience with the bot in php.

I checked out that link also and it looks pretty good so far. I got the task kill and the check if its alive, but all I need is the dll for ps


I can't find a dll extension for the ps commands. If anyone can help that would be great. Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum