[Pdns-users] pdns_control via php

Peter van Dijk peter.van.dijk at netherlabs.nl
Wed Sep 14 15:40:44 UTC 2011


Hello Klaus,

> Is the protocol on the control socket somewhere documented?
> 
> I want to talk to pdns_server from a php script, without using
> pdns_control. Are there any tools/libraries for php available?

The control socket protocol is very simple: just send your command (exactly like the arguments to pdns_control), terminated by a newline ('\n'). Then read until the socket closes:

$ echo rediscover| sudo socat stdio unix:/var/run/pdns.controlsocket
Ok
$ echo ccounts | sudo socat stdio unix:/var/run/pdns.controlsocket
negative queries: 0, queries: 0, non-recursive packets: 0, recursive packets: 0

> Is it possible to use an IP socket instead of the unix socket?

Not currently. You could use socat to proxy TCP to a UNIX socket, but authentication would be something to think about in that case.

Kind regards,
Peter van Dijk


More information about the Pdns-users mailing list