- 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
Host subscription PHP-FPM handler used to run the script was restarted by Plesk during the website creation.
Switch "Host" subscription PHP handler to run as FastCGI application in Domains > example.com > PHP Settings .
If the issue is not fixed, point target domain creation under other than "host" subscription.
Alternatively, the same script can be executed from the command line:
# php /var/www/vhosts/example.com/httpdocs/example.php
<?xml version="1.0" encoding="UTF-8"?>