Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AquinoBR's avatar

Website Hosting Automation

Hello, I need to create a system that automates the creation of a website and creates a new database.

For example, a new user has purchased a website.

I need this system in PHP to create a subfolder and host all the files of the site and after that create a database for this new user.

Setting up the database I know is possible, but I would like to know how to do to create the subfolder and host the files automatically.

Any suggestions for doing this in PHP? Thank you!

0 likes
6 replies
jlrdw's avatar

You need a large Bank of servers for that sort of thing, and the cost could be in the hundreds of thousands of dollars.

Are you sure you don't need a multi-tenant application.

And I would imagine rather than asking about that here you could probably get more results from a good Google search on multi-tenant setup.

artcore's avatar

Keep in mind the linux user/group ownership and file access, DNS zones, Apache vhost, ftp account, email auth and accounts...there's a lot involved...

Your best bet is probably using the WHM/cPanel api or similar via WHMCS for instance or by implementing the whm api in php yourself (or any other webhost panel).

A possible alternative is to use shell via php if you know how to do all mentioned from command line.

Snapey's avatar

You are likely to need some bash script to run on the server to do all the provisioning, configure a new virtual host etc etc

Depending on how you want the domain name to look, you might also need to get involved in DNS changes

But really, only if you know all the steps to manually deploy a site will you be able to automate it.

( @salomon022 - are you sure you are posting to the right question? )

Please or to participate in this conversation.