Symptoms
- Plesk shows the following error after login:
Internal error: Domain Service Web not exists: domain=sub.example.com, id=41
Domain Service Web not exists: domain=sub.example.com, id=41
File DSWeb.php
Line 76
Type PleskFatalException
- The following errors may be shown in the /var/log/plesk/panel.log file:
[2015-11-23 22:23:48] ERR [panel] Failed to search for WordPress instances on subscription example.com: Domain with id=270 was not found
[2015-11-23 22:23:52] ERR [panel] Attempt to change status of non-configured mail service. [domain_id = 270]
[2015-11-23 22:23:52] ERR [panel] Unable to load object of type PhDomain with id=270: Turn off domain failed: Unable to find service node for web service on domain with id=270
[2015-11-23 22:23:52] ERR [panel] Some of the subscriptions selected were not suspended.<br>Unable to load object of type PhDomain with id=270: Turn off domain failed: Unable to find service node for web service on domain with id=270
[2015-11-23 22:23:59] ERR [panel] No data.
[2015-11-23 22:24:09] ERR [panel] Failed to search for WordPress instances on subscription example.com: Resource with UID 'bd314c87-865a-46e6-b694-342e71899445' not found.
Cause
The domain mentioned in the error messages has been deleted, but PSA database still contains an entry for this domain.
Plesk database was not properly upgraded. The ' psa.DomainServices ' table has no records of the "web" type.
Resolution
Note: This article may require additional administrative knowledge to apply. If any help required, contact server's administrator or hosting support.
Warning: Please check that the domain physically exists before making changes. If it does, back up all the domain content from the corresponding directories /var/www/vhosts/<domain> and /var/qmail/mailnames/<domain> (in case of Linux) or from C:\Inetpub\vhosts and %plesk_dir\MailEnable\postoffices% (in case of Windows).
Scenario 1. Domain physically exists in Plesk
1.Connect to the server via SSH (Plesk for Linux) or RDP (Plesk for Windows)
2.Create Plesk database backup
3.Remove the domain with ID in psa.domainsmentioned in the first error message from the PSA database:
#plesk db "DELETE FROM domains WHERE id='41'"
4.Find orphaned records in the databases as follows:
For Plesk on Linux:
1.Create psa and apsc database backups:
#plesk db dump psa > /root/psa_dump_$(date +'%Y-%m-%d').sql
#plesk db dump apsc > /root/apsc_dump_$(date +'%Y-%m-%d').sql
2.Find orphaned records in table psa.domains using the values mentioned in the error messages:
#grep 'bd314c87-865a-46e6-b694-342e71899445' /root/apsc_dump_$(date +'%Y-%m-%d').sql
#grep 'bd314c87-865a-46e6-b694-342e71899445' /root/psa_dump_$(date +'%Y-%m-%d').sql
#grep 'example' /root/apsc_dump_$(date +'%Y-%m-%d').sql
#grep 'example' /root/psa_dump_$(date +'%Y-%m-%d').sql | grep -v -E 'log_components|exp_event'
INSERT INTO Configurations (id, name, serviceNodeId, file, version, objectType, objectId, status, active, description, errorFile) VALUES (115,'nginxDomainWebmail',1,'/etc/nginx/plesk.conf.d/webmails/example.com_webmail.conf','14240541100.61180300','nginxDomain',28,'ok','true',NULL,'');
For Plesk on Windows:
1.Open an elevated powershell window to execute the following commands
2.Create psa and apsc database backups:
plesk db dump psa > psa_dump_$(get-date -f yyyy-MM-dd).sql
plesk db dump apsc > apsc_dump_$(get-date -f yyyy-MM-dd).sql
3.Find orphaned records in table psa.domains using the values mentioned in the error messages:
(Select-String -Path apsc_dump_$(get-date -f yyyy-MM-dd).sql -Pattern "INSERT INTO ``.*bd314c87-865a-46e6-b694-342e71899445"|Select-String -Pattern "log_components|exp_event" -NotMatch ).Line -split "(?=,()" -split "(?= ()" | Select-String -Pattern "INSERT INTO|bd314c87(Select-String -Path psa_dump_$(get-date -f yyyy-MM-dd).sql -Pattern "INSERT INTO ``.*example"|Select-String -Pattern "log_components|exp_event" -NotMatch ).Line -split "(?=,()" -split "(?= ()" | Select-String -Pattern "INSERT INTO|example"
INSERT INTO `hosting` VALUES
,(41,'false','false','true','false','fastcgi-7.4','false','false','false','false','true','4.0','true','awstats','false','hosting_write_template.xml','C:\Inetpub\vhosts\example.com\httpdocs','false',0,-1,-1,'true')-865a-46e6-b694-342e71899445"
(Select-String -Path psa_dump_$(get-date -f yyyy-MM-dd).sql -Pattern "INSERT INTO ``.*bd314c87-865a-46e6-b694-342e71899445"|Select-String -Pattern "log_components|exp_event" -NotMatch ).Line -split "(?=,()" -split "(?= ()" | Select-String -Pattern "INSERT INTO|bd314c87-865a-46e6-b694-342e71899445"
(Select-String -Path apsc_dump_$(get-date -f yyyy-MM-dd).sql -Pattern "INSERT INTO ``.*example"|Select-String -Pattern "log_components|exp_event" -NotMatch ).Line -split "(?=,()" -split "(?= ()" | Select-String -Pattern "INSERT INTO|example"
5.Remove orphaned records from prior step by executing SQL DELETE statements on psa database:
#plesk db "DELETE FROM Configurations WHERE id=115"
#plesk db "DELETE FROM dns_zone WHERE id=270"
#plesk db "DELETE FROM hosting WHERE dom_id=41"
Scenario 2. Domain does not physically exist
1.Connect to the server via SSH (Plesk for Linux) or RDP (Plesk for Windows)
2.Create Plesk database backup
3.Access Plesk database
4.Change htype of incorrectly removed domain to none:
mysql> update domains set htype='none' where id=41;
5.Domain will become visible in Plesk interface with "No hosting".
6.Remove the domain through Plesk interface in Domains > select example.com > Click Remove
Scenario 3. Applicable when domain exists or does not exists.
1.Connect to the server via SSH (Plesk for Linux) or RDP (Plesk for Windows)
2.Create Plesk database backup
3.Access Plesk database
4.Add the missing entries to the PSA database with MySQL query.
First, check that there is an entry in 'DomainServices' for this domain:
mysql> select * from DomainServices where dom_id = 41;
+-----+--------+------+--------+---------------+----------------+
| id | dom_id | type | status | parameters_id | ipCollectionId |
+-----+--------+------+--------+---------------+----------------+
| 322 | 41 | mail | 16 | 585 | 322 |
+-----+--------+------+--------+---------------+----------------+
1 row in set (0.00 sec)
Add a similar "web"-type entry, and add related records to 'IpAddressesCollections'
mysql> begin;
mysql> select @dom_id := <missing_domain_id>;
mysql> select @ip := (select dr.val from dns_recs dr, domains d where d.id = @dom_id and dr.dns_zone_id = d.dns_zone_id and dr.type = 'A' and dr.host = concat(d.name,'.'));
mysql> select @ip_id := (select id from IP_Addresses where ip_address = @ip);
mysql> INSERT INTO IpCollections VALUES (NULL);
mysql> SELECT @ip_collection_id := LAST_INSERT_ID();
mysql> insert into IpAddressesCollections (ipCollectionId, ipAddressId) values (@ip_collection_id, @ip_id);
mysql> insert into DomainServices (dom_id, type, status, parameters_id, ipCollectionId) values (@dom_id, 'web' , 0, 0, @ip_collection_id);
mysql> commit;