- Plesk for Linux
The PHP script for the domain or sub-domain creation was made based on API examples https://github.com/plesk/api-examples/tree/master/php. During the attempt to call the script
http://example.com/script.phpvia the browser it creates the expected domain or sub-domain, but it returns the following error:
PLESK_INFO: 502 Bad Gateway
PLESK_INFO: 503 Service Unavailable
If the webpage is renewed, the following information is shown:
PLESK_INFO: <errtext> Incorrect name subdomain.example.com. This domain name already exists. </errtext>
However, the subdomain is created normally.
Host subscription PHP handler used to run the script is configured with PHP-FPM handler
Target domain is pointed to the "Host" subscription (subscription from which the API request is sent)
Host subscription's PHP-FPM handler used to run the script, was restarted by Plesk during the website creation.
Perform one of the following to fix the error:
Change host subscription's handler type
Switch "Host" subscription PHP handler to run as FastCGI application in Domains > example.com > PHP Settings .
Point creating domain to another then "host" subscription.
Execute php API script from command line using the following command:
# php /var/www/vhosts/example.com/httpdocs/example.php
<?xml version="1.0" encoding="UTF-8"?>