PPPHP

Database Manager

Create real databases, hand them to users with their own isolated logins, provision through cPanel or DirectAdmin when plain SQL cannot, cap how much space each one may use, and keep a warm copy on a backup server.

Who is this for? Owners. The page lives at /platform/databases and is hidden from everyone else. There is also a quick in‑page Guide button; this document is the deeper reference.

Contents

The model

Three things stack up:

A user assigned a database picks “Use my database” when creating a project. They never see the password — the platform injects the connection server‑side.

Provisioning through a control panel

On shared hosting the MySQL account your application runs as almost never has CREATE DATABASE. You get:

SQLSTATE[42000]: Access denied for user '...'@'%' to database '...' (1044)

That is not a bug to work around with a bigger password — the account genuinely lacks the privilege, and on most shared hosts it always will. Two ways forward:

  1. A privileged MySQL login — store one on the platform server row via Set account. It is verified with a live create/drop probe before it is saved.
  2. A control‑panel driver — let cPanel or DirectAdmin do it over their API, which is the same route the panel’s own UI takes. Usually the better answer, because it needs no elevated MySQL account at all.

Registering a panel

Add external server → choose the driver. The form reshapes itself.

Press Test before Add. Test reports which endpoint answered, so a blocked port is never mistaken for a bad token.

Name prefixes

Both panels force the account name onto everything they create. Ask for orders and you get youracct_orders. The two panels disagree about how to be asked — cPanel wants the full prefixed name, DirectAdmin wants it bare and adds the prefix itself — so PPPHP always stores the name the panel actually created rather than the one it requested. What you see in the list is what exists on disk.

The two addresses, and why they differ

The most common setup mistake. The address that provisions a database is not the address that uses it.

A panel answers on something like cpanel.example.com:2083. The MySQL those databases live on is usually localhost, reachable only from that machine. So:

If projects fail to connect while the panel tests fine, this is almost certainly why. Verify will tell you outright.

Storage limits

PPPHP is a development platform. A project here holds a schema and a little demo data; the real database lives on whatever hosting the user deploys their generated app to. So each managed database has an allowance — Limit / db in the Databases header, default 5 MB. It applies to every database, not only new ones.

Users see a usage bar on their Projects page, colour‑changing at 75%, 90% and 100%.

What is actually enforced

Worth being precise, because the word “limit” promises more than any system here can deliver. MySQL has no per‑schema disk quota and shared hosting gives no filesystem quota, so nothing can physically stop a row inserted by a user’s own generated app. What the limit does do:

The platform’s own database is exempt: it holds every project, licence and visitor row and is legitimately far larger than any per‑project allowance.

Replication to a backup server

An install is either the primary or a backup. Two separate things travel between them, and confusing them causes the most support questions:

A database appearing in the backup’s list does not mean its data is there. The catalogue is replicated; the data is cloned. Use the Replication panel, which only appears on a backup.

How a clone decides what to copy

The backup asks the primary for a fingerprint per table, compares it against its own replica, and pulls only what differs. An estate where nothing changed transfers nothing at all. Fingerprints are checksums, not size estimates — an UPDATE that changes a value without changing row count or size is still detected.

Everything is restored into a replica_* database. A clone can never be written over a live one; that rule is enforced in code, not by convention. Tables deleted on the primary are removed from the replica too.

Scheduling

Turning “Scheduled” on does not clone anything by itself. It records the intent; a cron entry has to call it. The panel warns you if the switch is on and nothing has run it.

The panel's How to schedule it box shows the exact command for this server — copy it into your host's cron (every 6 hours is a good default).

On hosts with no shell cron, point a cron service at the web‑cron URL shown under How to schedule it. It carries a per‑install secret — treat it as a password.

Creating and assigning are disabled on a backup. Do both on the primary and let them replicate.

Verify

Verify connects with the exact credentials a project would be handed, then creates and drops a table. It proves the database works end to end rather than merely existing in the list.

Reach for it whenever a user says their project cannot connect: it separates a wrong Database host from a permissions problem and says which.

Troubleshooting

SymptomUsually means
1044 Access denied on create The account cannot CREATE DATABASE. Use a panel driver, or store a privileged login with Set account.
Panel Test passes, projects cannot connect Database host is unset or wrong — you are handing projects the panel’s address instead of MySQL’s. Run Verify.
cPanel returns 403 Access denied Token, username, or the token lacking database permissions. A 403 from a fallback endpoint can also mean the direct port is firewalled — Test names which endpoint answered.
Backup lists a database, phpMyAdmin does not show it Expected. The catalogue replicated; the data has not been cloned yet. Press Clone now.
Clone says “No tables yet” The source database is genuinely empty. Normal for a new project.
“Scheduled” is on but nothing clones No cron entry is calling it. Add one from How to schedule it.
Replica deleted by hand Self‑heals. The next run notices the copy is gone and re‑clones it.
Size shows 0 B Either the database really is empty, or it is unreachable — Verify distinguishes the two.