How to set up a PHP daemon?


How to set up a PHP daemon?



I will be writing my first daemon in php and I have a couple really basic questions that I need help with.

  1. What packages need to be installed on my linux server and Does anything in PHP need to be enabled? So far I have gotten this - http://pear.php.net/package/System_Daemon/download

  2. Where on server do I save my daemon files?

  3. I have a number of files that need to be included within the daemon that contain classes and functions for gathering emails and attachments through IMAP. All of these files are currently in my web public directory, how do I include these files within my daemon?

I think that is everything I need to get started. Thanks so much!




POSIX: allocate 64KB on 64KB boundary

1:



Ofstream writes empty file on linux
  1. What packages need to be installed on my linux server and Does anything in PHP need to be enabled? So far I have gotten this - http://pear.php.net/package/System_Daemon/download
As long your php installation includes sockets you'll be able to write any daemon.


Socket read() hangs for a while when there is no data to read
Most of current php packages provides sockets support.


where did the _syscallN macros go in <linux/unistd.h>?
You need a shell access to be able to configure and execute your daemon, it won't be done by serving it as a web application..
Clone-equivalent of fork?
I don't know about the package you mentioned but it's likely to be a way to make you easier to write and maintain your daemon..
Winlibre - An Aptitude-Synaptic for Windows. Would that be useful?
  1. Where on server do I save my daemon files?
Anywhere, you just need a shell access, you'll probably need root privileges, if you need to launch it on a port under 1024.


plug-in architecture based c/c++ application
Create a special user, eventualy make a jail, you'll probably be fine..
How do I rename a process on Linux?
  1. I have a number of files that need to be included within the daemon that contain classes and functions for gathering emails and attachments through IMAP.

    All of these files are currently in my web public directory, how do I include these files within my daemon?
Use a config file, such as a ini which is supported by PHP to specify a data directory and read from.. Further reading :.



54 out of 100 based on 39 user ratings 164 reviews