# Example - PHP and MySQL

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>"}}
```

2. Create the database user with the returned database id:

```
POST /dbusers
{"login": "app_user", "password": "<password>", "database_id": <databaseId>}
```

3. 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.
