But if what you want is the user to be able to create their own files or website layout - then that's a broad topic that could take a totally different direction.
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.