Run PHP inside DNS zone Bind 10 Run PHP inside DNS zone Bind 10 linux linux

Run PHP inside DNS zone Bind 10


With bind this is, as far as I know, not possible.

The solution that I would recommend is using powerDNS.

PowerDNS is more flexibel, and is able to use a database. I'm using it with a MySQL database for example.
Maybe that's directly what you want, maybe it isn't. But with the flexibility of using a database, you can create a PHP script that inserts everything in the database, and checks it, and so on.


You have to use BIND Full function API, that allows the 'plug-in' to replace BIND's internal database function for nominated zones and from BIND.

You will need to edit the BIND source files and makefile.in and then re-build BIND including your source and header files.

To start with he API, find file db.h which is located in the directory bind-release/lib/dns/include/dns/db.h where bind-release should be replaced with the location and version number where you unpacked the source distribution e.g. /usr/src/bind/10.1.2

Here is a copy http://pastebin.com/yTN5Aq03


If you have to use bind, then something like the following solution should work.

  1. Build a script to output the zone file. Can use php or just about any language to do this.
  2. Once the file is generated reload bind to load the updated file.
  3. If this data changes regularly, use cron to run both commands on a 5 minute interval or something appropriate to your data.