This project is not covered by Drupal’s security advisory policy.

Thanks to the daemon module you can run daemon instances of a drupal site.

Create a daemon configuration with the administration UI, then launch it in a terminal with a command like:

$ drush daemon my_daemon_name

... and TADA ! you have an instance of your drupal site running as a daemon in its own process.

The goal of this module is NOT to replace apache, but you can use it if you want a daemon process on your system doing 'stuff' using the drupal APIs.

I repeat: The main goal is not to allow a daemon to serve pages as apache do, even if it may be possible if you create a Listener that implements a full HTTP server, but that's overkill, really, don't do that... except maybe for fun.

Sponsored by



In addition to daemons created with the administration UI, modules can define default daemons (a bit like default views in views module). Some default daemons are provided as examples.


Daemon with a stupid HTTP server on port 41000 that echo requested URL.

For example:

$ drush daemon http_echo

In a browser, go to: http://localhost:41000/foobar

The daemon returns the text: "You asked for url: /foobar"


Daemon with a HTTP server on port 41001 that fires the drupal menu system and return the result (not "page" themed).

For example:

$ drush daemon http_menu

In a browser, go to: http://localhost:41001/node/1

The daemon fires the drupal's menu system on path node/1, and return back the result to the browser, but without calling theme('page', ...).


  • hook_daemon_listeners() - Modules can define listeners that can be added to daemons. A listener is a class that is instantiated each time a client connects to the daemon on a specific port, and that handle this connection. Have a look to the default handlers provided with nanoserv: there are simple HTTP, Soap, XML-RPC, SMTP and Syslog handlers.
  • hook_daemon_default_daemons() - Modules can define default daemons configurations. They setup which listener will be active in a given daemon, and for each listener on what port and with what protocol (tcp or udp).
  • hook_daemon_timeout($tid) - This hook is called when a timer is fired. The argument $tid correspond to the Timer id. If return value is false then the timer is stopped, else the timer will be fired again.

Future work

  • Allow to activate the fork setting on listeners, so that every accepted connection is handled in a forked child process

Project Information

  • Maintenance status: Unknown
  • Development status: Unknown
  • Module categories: Developer, Drush
  • Downloads: 1,295
  • Last modified: 1 December 2014
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.