SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2005
    Location
    Atlantis
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Advanced - signal handling

    Hello,

    This may seem different from a php approach however i am trying to write a server in PHP. I have written a very simple socket server, which reads input from keyboard and writes the same to you back.

    My server is working fine with child processes. However if anyone quits the server, that child process becomes defunct. I added signal handling but i seem unable to receive any signals on the server. posix_kill , or direct kill -9 through command line does not work for the childs too.

    If anyone here knows signal handling on unix, i would like to share the piece of code i wrote, and you can help me before there is no hair left on my head.

    http://pastey.net/2899

  2. #2
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See pcntl_signal and comments.

    php is not designed to write daemons. If you want to save your hair, switch to other language asap.


Bookmarks

Posting Permissions

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