Hows that SaaS work?

I cant find out how SaaS works.

Error checking aside, is this kind of how it goes?

  1. Signup
  2. PHP creates file for Apache:enabled-sites
  3. PHP creates a database for that user
  4. There is a subdomain for that user and…
  5. The users information is stored in a text-file
  6. The textfile links to the main backend system? while plugging in that users settings (So really 1 system of files is only being used)

Or is there some other way people are doing this?

I would use Mass Virtual Hosting for that. Imagine having to force-reload Apache (or any other httpd) for every user that is created, the server would be force-reloading 24/7 if you have a lot of sign ups!

Either that, or the tables have a user_id field that indicates to which of the users the record relates. Both options have their pros and cons.

See Wildcard DNS. Same argument I gave for Mass Virtual Hosting

Text file? No. Those are way too slow and instable to use in real world applications. It’s stored in a database.

Again, stored in a database :slight_smile:

I have set up my own SaaS very recently, my implementation works as such:

  • user signs up, account is created in central database, subdomain name is recorded
  • permissions are checked on page load - ie. are they allowed access to this subdomain
  • I have a DNS wildcard so that *.studiotime.com.au is routed to a single IP
  • all records are kept in a single database, with an account_id
  • there is only one instance necessary for the application code

This is definitely the way to go rather than creating virtual hosts and individual databases. You can always split database load later should they become too big.

Not a problem, you’re welcome :slight_smile:

Thank you so much! I have been perplexed over this a long time!
Apologies for my late thank-you, I’ve been burnt out over job interviews :stuck_out_tongue: