- 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
via 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.
Nginx is turned off server-wide.
Web server and FastCGI or FPM processes are restarted during site creation. FastCGI processes are restarted even if the graceful Apache restart is enabled.
1. Enable graceful Apache restart, as described in the article.
2. Switch PHP handler to run as CGI application in Domains > example.com > PHP Settings.
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"?>