I am building a system where every account has its own databases. Creating these databases when the user is actually creating the account results in a long wait before the page is refreshed. Logically, since php is still busy, so the page cannot finish.
Therefore my idea is to 'buffer' up a few, like 5 of these packages, all named $DBNAME$number, where number is 1 to 5. So I just rename the databases at account creation time, thereby minimizing the wait. I think this will work pretty well, but off course, I need to replenish my buffer.
That's where I figured I'd need a method to just replenish the database buffer in the background, which could even run while the accounts database is prepared, and the user is already logging in. The thing is, I haven't found a solution to this, while looking aroung a lot. I tried pthread, which runs exactly as if I would run the code inline. I even gave ajax a shot, hoping the .php file will run async, but it will not.
Does anyone have a recommendation on how to achieve this goal I have? PS: if xy problem, you may notify me ;)