PHP Daemon as Service

JAKWEB

Verified User
Joined
Sep 26, 2013
Messages
5
I have the latest DA on Debian and would like to have a php daemon as a service inside the directadmin console, would that be possible with a plugin or any other modification?

The php file should not be in the public_html folder (security wise) but it needs to have access to the database and config file when running.

Looking forward for any suggestions.

Thank you very much
Jerome
 
Personally I haven't created a plugin. But it should be very easy; http://help.directadmin.com/item.php?id=290

You can execute every code you want (when you click on a page within DA). I suppose you could then send controlling commands to your daemon. Also check out that 'Ability to completely control the socket' link, I think that might be handy for answering calls through ajax if you'd want that.

To run a PHP daemon, I've recently found a nice and easy way.

http://stackoverflow.com/a/16577806/808824

My example php file:

PHP:
<?php

file_put_contents("/root/test.log", "Starting the loop at ".time()."\n", FILE_APPEND);

while (1) {
file_put_contents("/root/test.log", 'test '.time()."\n", FILE_APPEND);

// wait for 2 seconds
usleep(2000000);
}


?>
 
Thank you, I will checkout the guide how to create a plugin in da.
 
Back
Top