Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    408
    Thanks
    18
    Thanked 26 Times in 26 Posts

    Question Start, stop, and check process with PHP on windows

    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!

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.


  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,298
    Thanks
    57
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    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.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    .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.

  • #5
    Regular Coder
    Join Date
    Sep 2011
    Posts
    408
    Thanks
    18
    Thanked 26 Times in 26 Posts
    Quote Originally Posted by Fou-Lu View Post
    .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

    Edit:
    I can't find a dll extension for the ps commands. If anyone can help that would be great. Thanks!
    Last edited by Dubz; 04-18-2012 at 08:42 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •