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