I am trying to make a hospital management system in php, so that atleast 4 hospitals are going to use it, and every hospital needs a special domain to login to the system. My question is how can i manage all these domains and databases to use one single host and also how can i send notifications if there is an update to the system.
-
Can't you create one database for each hospital? Then you can use one domain actually. – Dhanushka sasanka Oct 09 '19 at 19:28
-
1yes i can create, but how can i manage for example if the hospital needs only doctor and patient modules and doesn;t want any thing else so that i have to have a bility to close other modules and even if i want to make new update so that i have to go and change each one – yuu Oct 09 '19 at 20:02
-
2Those are three different questions. [How can I point multiple domains to one server?](https://stackoverflow.com/q/20228872/1941241) [Should I use a single or multiple database setup for a multi-client application?](https://stackoverflow.com/q/255616/1941241) How to send notifications when something changes is too broad, as it depends on too many factors. Do you want to send them via email, sms text message, push notification, something else? Does one update lead to one notification, or can one update lead to a thousand notifications? That's application logic you need to implement yourself. – rickdenhaan Oct 09 '19 at 20:04
-
you can also be versioning your application example that hospital wants doctor and patient that going version 1.0. Also others do not want that that application going version 1.1 etc. you can use versioning control repositories like ```git``` it will be easy to manage your applications. Also When you are trying to manage all hospitals in one database it will be a more and more responsibility to manage updates. Thinks you execute a query like ```delete * from patients```. take a good decision. – Dhanushka sasanka Oct 09 '19 at 20:41
-
Many thanks guys for clarifying the question although i couldn't get the full info. I am usin SWIFT hosting plan at A2host so i created a directory and i stored my PHP laravel files (the system files) and also public files i stored in the public, so that after pointing it and creating one domain with user and password and database, that domain will have ability to use it. but what if another domain with different database want to use? do i make another directory and copy the system files again, that will be difficult to control – yuu Oct 10 '19 at 03:31
1 Answers
Your question needs a little more details, but in general this is how it works.
I assume your a sys admin, and you will work on a Linux system, using apache.
You need to create users in the server, or at least different directories for all your websites, usually they will be under /www/{name of the site}/*
You will need a DB per each customer
You need to define if they will access only with different domain name or also in different tcp ports, usually multi-web-hosting happens all in port 80 or 443.
Read about Virtual hosts in apache, because the magic will happen there. https://httpd.apache.org/docs/2.4/vhosts/examples.html
This is how a single block will look like.
<VirtualHost 172.20.30.40:8080>
DocumentRoot "/www/example1-8080"
ServerName www.example.com
</VirtualHost>
- DNS, depending on how you are going to test, you need to modify the DNS records, if you are testing locally, you can modify your hosts, this will anyways redirect the traffic to the IP that you need, apache will take care of the rest.
*Forgot about the notifications, this depends a lot of your infrastructure, you can use emails, for that you need to configure sendmail or your favorite email server, you can also use push notifications if you have the web infrastructure to do so, etc.

- 1,172
- 9
- 24