plsk.org documentationAPICabinetplsk.org

Example - PHP and MySQL

Updated 2026-11-08

Base URL: https://api.plsk.org/api/plesk/v2. {domainId} is the id of the main domain.

  1. Create the database:
POST /databases
{"name": "app", "type": "mysql", "parent_domain": {"id": {domainId}, "name": "<hostname>"}}
  1. Create the database user with the returned database id:
POST /dbusers
{"login": "app_user", "password": "<password>", "database_id": <databaseId>}
  1. Write a PHP file with PUT /domains/{domainId}/fs/content?path=index.php.
<?php
$db = new mysqli("localhost", "app_user", "<password>", "app");
echo $db->server_info;

PHP 8.5 provides curl, mysqli and ZipArchive. Outbound HTTPS requests from PHP are permitted. The server_id field of POST /databases is not accepted.