How to keep running a Web application when offline

Dear Experts,
I am building an online booking system and would like to know what is the best way to tackle this problem. The booking application is always going be accessed by the ticket office staff and not the end users. The internet connection at the ticket office can drop intermittently for few minutes. I don't want the booking system to be unavailable during this period. I want to make sure the web application is able to run offline more for a short period without affecting the on going transaction or the bookings. Application will be using a Mysql Database.
Can someone please enlighten me on what's the best way to do this or guide me on the right direction?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Mark BradyConnect With a Mentor Principal Data EngineerCommented:
All good suggestions above by the way. A few years ago I did something similar. I had a local server (in my office) which you can setup in less than an hour. On that server I had a booking system that I wrote. All you need to do then is to have a script that is run by cron job that runs (in my case once every two minutes) that logs onto your online database and gets any new records and updates your local server. It all depends on where the main bookings will be done from

I would imagine they would be done online so if you reverse my logic then you have a script on your local server that would check for new records on line and update the local database.

It's quite easy to do. That way if the online website goes down or is not available you can log onto your local server and continue making bookings. It is called a sync system whereby it will sync data both ways. Your online server is constantly updated and so is your local server.

It would take a bit of planning but that is how I would tackle the job.
PHP is a server based scripting language. This means, code is always run on the server side. So no offline support exists for PHP.
You would need a client based scripting language, such as activeX or Java
Dave BaldwinFixer of ProblemsCommented:
Or put the application on a server in the ticket office that gets updates from the online system.  I think that's what I would do.
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Ray PaseurCommented:
To add to what ded_ch correctly pointed out, most client-side scripting languages will expect and require timely communication with the server.  The server is where the MySQL database will reside.  So the only possible solution is to fix the internet connection, perhaps by getting a redundant data pipe of some sort.
greetings   Herci, , You leave too much information Unknown, to give a specific answer, It seems that you would not need a internet "Server" to do this, ,  if all of your " ticket office staff" were in the same location, if they are in the same location, then you do not need an "Internet Server" but a local server, as several comments here have already told you about.

If your " ticket office staff" are NOT all in the same location, then you need an Internet connection "Server" , , and you can NOT have a PHP site that has the "Offline" mode, as several comments here have told you.
You will need to change your HOST for your internet "Server" from the unreliable one you use now, , to one that is near 99.9 % always online, with is Most of the Hosts (even the cheep ones).
HerciAuthor Commented:
Thanks for all the suggestions.
Slick - The ticket office staff could be in different rooms in the same location or could be in different geographic locations.

elvin - Main booking will be done via the online system. I thought about the same idea you've suggested but I wasn't sure whats the best way to do it. What I am not sure about is, if there are 5 booking machines in the booking office, I need to make one of them a local server. When the internet goes down I will be able to use the local server to take booking and not the other 4 machines? If the staff want to keep using all the machines for taking bookings, then do I need to make each machine a local server? Also are there any security implication of having a local server/DB?
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
If the staff are different geographic locations, then there is no point to creating a 'local server' to avoid outages because it would be necessary to use the internet from the different geographic locations to get to it anyway.
Mark BradyConnect With a Mentor Principal Data EngineerCommented:
Ok I think we are all getting a small idea on what you want but could you possibly extend our knowledge on exactly how you system is setup? So when you say booking machines you mean pc's right?

If so, then yes you could have a local server setup which hosts your booking program. That machine will have an ip in which other local pc's on that network (internal mainly but you could setup a VPN as well). They all log onto the same system in one building for example.

In that case, who cares if the internet goes down because everything is on you local server. I'm guessing that is not the case but do go ahead and enlighten us on how this structure is put together so we may advise you as best we can.

HerciAuthor Commented:
Elvin- There are going to be about 6 desktop PCs and several tablets in the booking office. All these machines will be used for taking bookings. There will also be an online site for the home users to make bookings. All these bookings will go into a central database.
I think as you've suggested, having a local server would be a good idea. We can then allow the PCs and tablets to take the bookings via the local site. We can then have a cron job to push the local bookings up to the central server. We can also have a cron job to download the ticket availability information from the central DB to the local DBs. This way the central database and the local databases will have an up to date ticket availability information. Of course, if the internet is down, then the cron jobs won't work. But as soon as the internet is back on, it should update the records. At the moment I am assuming the internet won't be down for over 48 hours in a single stretch.
What do you think? Does it sound like a good structure?
Mark BradyConnect With a Mentor Principal Data EngineerCommented:
Yeah I think so. The internet would never go down for that long unless you had a very poor hosting company. I am with and we have had 1 outage for an hour about two years ago. I've been with them for 5 years.

Yes a simple cron job would keep your databases in sync. I run a similar sync system on my servers every two minutes as I have a busy commercial website.
HerciAuthor Commented:
Thanks everyone.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.