So that the daemon won’t die

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

So that the daemon won’t die

Long running processes and PHP

Leszek Krupiński

April 03, 2017

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

71 slides
  1. So that the daemon won’t die Long running processes and

    PHP Leszek Krupiński 4developers 2017
  2. • redirect streams / close descriptors • fork • detach

    from console • respond to signals • close nicely
  3. 1. Call umask(0) to prevent permission issues. 2. fork() and

    have the parent exit. 3. Call setsid(). 4. Setup signal processing of SIGHUP and SIGTERM. 5. fork() again and have the parent exit. 6. Change the current working dir with chdir(). 7. fclose() stdin, stdout and stderr and don't write to them. 8. Process!

More Decks by Leszek Krupiński

Other Decks in Programming