Offline and online PHP application

Asked

Viewed 2,199 times

1

I wanted to know if it is possible and, if so, which technologies I can use to create an application that runs offline and when the user has connected to the net, the data is taken to the server (hosting) automatically?

  • you can use the browser sqlite to store and then send the stored data to the server online

  • Even closing the browser data still got saved?

  • yes guy, it saved in the browser "memory", it would be like an internal browser database

  • I see. Vlw, Marcos!

  • I’ll give you an example, but in javascript

  • It is impossible to answer because there are several ways to solve and there is no way to determine which technique is best suited to your specific case. To determine you need to make a thorough analysis of your project and yet there may be conflicts of opinion about what is most appropriate or not. In short, too broad a theme and based on opinions.

  • Despite an interesting question, the site is for questions and objective answers, and your question is more suitable for the exchange of opinions and discussion, that escape our format. Here are some tips on the questions that work well in our format: [Ask], What kind of questions should I avoid asking?, What topics can I ask and [Help].

Show 2 more comments

3 answers

0

Summary

It is impossible to answer because there are several ways to solve and there is no way to determine which technique is best suited to your specific case. To determine you need to make a thorough analysis of your project and yet there may be conflicts of opinion about what is most appropriate or not. In short, too broad a theme and based on opinions

Yes! We Can!

But if you really want to know if it’s possible, yes, it’s possible.

You can run the PHP application offline on the client’s local machine and have the same application online on a server. You can even install Mysql in the client. Anyway, the client itself would be at the same time the server for the offline version.

Perhaps the most critical point is synchronization between offline data and online data.

If the application is unique to a single client (a single computer), this will not be a problem, but if there is more than 1 client, the thing complicates as it should be more careful regarding duplicate keys, etc.

Even if it is only 1 customer, one should take care.

Case study

Another example is, if there is more than one user, suppose one of these deleted a record and synchronized. The next day another user who is offline needs this record. On his PC the record still exists so he makes the pins he needs to make and synchronizes. Then it starts to play on everything because the other user had deleted the day before.

Dealing with single keys is easy. But as you can see, in this small example of deletion the thing starts to complicate.

Completion

Therefore, I repeat what I mentioned above, without analyzing the complete project there is no way to indicate to it adequately what can be better applied.

The key point of all this is logistics. Think of logistics and the project itself to determine what might be feasible.

0

The sqlite follows the same principle of mysql, how do you use the php, follows an example: http://php.net/manual/en/sqlite.setup.php, in your case you would make a if checking if there is connectivity, starting from this idea there are two ways to track this request:

  • Setting in sqlite when it is offline and when the connection occurs it sends to the server.
  • Or, you arrow everything offline and only when you want or by definition the user performs synchronization.

More about the Sqlite: http://www.devmedia.com.br/sqlite-o-pequeno-notavel/7249.

  • 1

    Vlw, man. I’ll try to implement it right away!

  • I’m happy to help

-1

PHP is a server-side language, meaning you need to send data to the server, which will return a response. So PHP cannot run on a machine without a web service running.

At least it would be necessary to have an apache, Nginx or localhost(wamp/xammp/Lamp) running on each machine that intends to use its site offline, it would need to be fully stored in the browser cache. You would need to store data in cookies, etc...

It’s even possible, but it can be unfeasible depending on the type of service you intend to offer

  • 1

    It was not me who gave the negative, but this is wrong: "So PHP cannot run on a machine without a web service running.". PHP can be run normally as an executable with no web or browser involved.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.