PHP fwrite EOF?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • toniintc@gmail.com

    #1

    PHP fwrite EOF?

    Hi all,

    I have heavily modified DNS Control
    (http://freshmeat.net/projects/dns/) for my needs. I have an issue
    with what I believe must be some kind of non-EOF terminated zone files
    preventing named (9.3.2-P1) from reading it. Here's the (unchanged)
    code that writes the zone file:

    $zone .= $records_mx . $records_a . $records_cname . "\n";
    $f = fopen($this->path . "/$letter/" . $domain, "w");
    fwrite($f, $zone);
    fclose($f);

    Now, when I execute the above code for "test.com" and query via
    nslookup (after doing an "rndc reload" to prompt bind to re-read its
    configuration) I get "server can't find test.com: NXDOMAIN". If I then
    edit the zone file with vi and do nothing more than go to the end of
    the file and add a blank line, save, and do another "rndc reload", I
    can then query the zone successfully (for the record, just doing two
    "rndc reload"s without editing the file doesn't work). I've tried
    writing extra newlines (\n), a carriage return (\r) and a bunch of chr
    codes to the zone file from the code to no avail. I've Google'd a
    couple days to no avail - just one reference that pointed me to the
    problem but didn't offer a solution.

    What should I be using in the code? What am I missing?

    Thanks,
    Toni

Working...