How to keep running a Web application when offline

Posted on 2013-05-24
Medium Priority
Last Modified: 2014-02-03
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?
Question by:Herci
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +3

Expert Comment

ID: 39195648
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
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39195687
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.
LVL 111

Expert Comment

by:Ray Paseur
ID: 39195690
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.
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

LVL 20

Accepted Solution

Mark Brady earned 1200 total points
ID: 39196551
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.
LVL 34

Expert Comment

ID: 39196887
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).

Author Comment

ID: 39203144
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?
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 300 total points
ID: 39203250
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.
LVL 20

Assisted Solution

by:Mark Brady
Mark Brady earned 1200 total points
ID: 39203275
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.


Author Comment

ID: 39214876
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?
LVL 20

Assisted Solution

by:Mark Brady
Mark Brady earned 1200 total points
ID: 39216783
Yeah I think so. The internet would never go down for that long unless you had a very poor hosting company. I am with inmotionhosting.com 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.

Author Closing Comment

ID: 39829018
Thanks everyone.

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question