• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Apply DNS Zone changes

cipcip

Basic Pleskian
Hello,

I created a PHP script that via XML modifies the DNS zone of a given subdomain.
When I login to my plesk panel, I get this warning in the subdomain DNS zone:

Warning: The DNS zone was modified. If you would like to apply DNS template changes to this zone, either click the 'Apply DNS Template Changes' button on this page or choose the 'Apply the changes to all zones' option in Server Administration Panel > Tools & Settings > DNS Template Settings > Apply DNS Template Changes.

Can I do this from XML? What should I do in this case ?

Thank you,
Cristian
 
Ok, I read a little bit more the API Docs and I found this.

Code:
<packet>
<dns>
<sync-with-template>
   <filter>
      <used-ip>123.123.123.123</used-ip>   
   </filter>
</sync-with-template>
</dns>
</packet>

But I do not understand what is the used-ip.
The used-ip is the ip of my plesk hosting? The thing is that I want to let third party people add their own dns to their subdomains.

Thank you,
Cristian
 
So it's the owner of the subdomain ip address, that kind of make sense, since when i host my domain, for the A record, I have my hosting ip address.

Thank you.
 
I incorporated that into my code and the following XML has been generated:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.6.0">
<dns>
<add_rec>
<site-id>53</site-id>
<type>CNAME</type>
<host>subdomain</host>
<value>value</value>
</add_rec>
</dns>
<dns>
<sync-with-template>
<filter>
<used-ip>123.123.123.123</used-ip>
</filter>
</sync-with-template>
</dns>
</packet>

Response I get is:

Code:
<?xml version="1.0" encoding="UTF-8"?> 
<packet version="1.6.6.0"> 
<dns> 
<add_rec> 
<result> 
<status>error</status> 
<errcode>1007</errcode> 
<errtext>Such a DNS record already exists.</errtext> 
</result> 
</add_rec> 
</dns> 
<dns> 
<sync-with-template> 
<result> 
<status>ok</status> 
</result> 
</sync-with-template> 
</dns> 
</packet>

The only error I get is that I used the same DNS package to be sent, but the result of the apply dns it says OK.

Any ideas ?
 
I think I know why, I have to talk where I bought the VPS, because DNS Zones are not enabled by default in Plesk, and I have to change that according to: DNS Zones for Subdomains

Tried to login via SSH with Putty onto the server and when I sent the command, got the following error:
plesk bin server_pref -u -subdomain-dns-zone own
terminate called after throwing an instance of 'std::runtime_error'
what(): Unable to init lock manager shared memory file: Current user is not p ermitted to use lock manager shared memory
Aborted

What to do next ? Is it because I have a VPS and not a Dedicated Server ?

Thanks,
Cristian
 
Last edited:
what(): Unable to init lock manager shared memory file: Current user is not p ermitted to use lock manager shared memory
Aborted
Looks like that /dev/shm mount point is missing in the /etc/fstab file.
Check it with

# grep shm /etc/fstab

If necessary, add line

shm /dev/shm tmpfs defaults 0 0

Then mount /dev/shm and restart the psa service:

# mount /dev/shm
# /etc/init.d/psa restart
 
Any command that i send via putty, is giving the same error... I checked the first row to see if it exists, then I added the line that you told me, same error.
 
Hello guys,

I still have issues with this, I have purchased another hosting, I was able to enable by default DNS zones for subdomains as @IgorG suggested, but it seems that my php script although it returns success, it does not apply the DNS to the zone.

The PHP function is as follows:

PHP:
function syncDNS($nom, $usedip)
{
    $xmldoc = new DomDocument('1.0', 'UTF-8');
    $xmldoc->formatOutput = true;
    $packet = $xmldoc->createElement('packet');
    $packet->setAttribute('version', '1.6.6.0');
    $xmldoc->appendChild($packet);
    $sync = $xmldoc->createElement('dns');
    $packet->appendChild($sync);
    $filter = $xmldoc->createElement('sync-with-template');
    $sync->appendChild($filter);
    $filterdoi = $xmldoc->createElement('filter');
    $filter->appendChild($filterdoi);
    $usedip = $xmldoc->createElement('used-ip', $usedip);
    $filterdoi->appendChild($usedip);
    return $xmldoc;
}

What the XML returns, I get:

<?xml version="1.0" encoding="UTF-8"?> <packet version="1.6.6.0"> <dns> <sync-with-template> <filter> <used-ip>123.123.123.123</used-ip> </filter> </sync-with-template> </dns> </packet>
<?xml version="1.0" encoding="UTF-8"?> <packet version="1.6.6.0"> <dns> <sync-with-template> <result> <status>ok</status> </result> </sync-with-template> </dns> </packet>

But still, If I open up Plesk and go to the specific domain, I get the following:

Warning: The DNS zone was modified. If you would like to apply DNS template changes to this zone, either click the 'Apply DNS Template Changes' button on this page or choose the 'Apply the changes to all zones' option in Server Administration Panel > Tools & Settings > DNS Template Settings > Apply DNS Template Changes.

Can you please help me out with this ?

Thank you,
Cristian
 
This should be moved to the plesk onyx forum since that is what i have now and i encounter the same warning.

Thank you,
Cristian
 
Back
Top