使用PHP通过cPanel创建mysql DB并导入* .sql文件

I want to create a DB for each user who wants to register to my Web-app. When i try this local everything perfectly works. A User can register with his email and pw. A DB is created and a import.sql file is imported so that the DB created for the User is empty on data but the tables and realtioships are given.

My Host uses cPanel and phpMyAdmin to create DB and db-user. I want to do this with php like i do it local. Does anyone have an idea how i get this done?

I've already searched and tryed stuff out but nothing works for me.

If possible some explanations on cPanel maybe would be enough.

            <?php
            require("xmlapi.php"); // this can be downlaoded from https://github.com/CpanelInc/xmlapi-php/blob/master/xmlapi.php
            $xmlapi = new xmlapi("cpanlel host name");   
            $xmlapi->set_port( 2083 );   
            $xmlapi->password_auth('cpanel username','cpanel passsword');    
            $xmlapi->set_debug(0);//output actions in the error log 1 for true and 0 false 

            $cpaneluser='cpanel username';
            $databasename="something";
            $databaseuser="database username";
            $databasepass= 'database password';

            //create database    
            $createdb = $xmlapi->api1_query($cpaneluser, "Mysql", "adddb", array($databasename));   
            //create user 
            $usr = $xmlapi->api1_query($cpaneluser, "Mysql", "adduser", array($databaseuser, $databasepass));   
            //add user 
            $addusr = $xmlapi->api1_query($cpaneluser, 'Mysql', 'adduserdb', array('' . $databasename . '', '' . $databaseuser . '', 'all'));
            ?>

Using the above code you will be able to create new database, add new user to database and give all access to user on database.