Choosing PHP or Java platform?

Choosing and trying different platforms for developing a web application (thin client, important for iOS platforms), which should have a cross-platform offline version. I’m already completely confused, I thought to write in Java, it seems that PHP is quite suitable for our simple application (it’s easier to learn), many projects have been implemented in PHP and such high-load ones as VKontakte.
The main difficulty of our projectis that the online and offline versions must have one code and one interface (so that they do not have to be written separately).

We see the following solution:

  1. Write a desktop Java application and deploy it to a server.
    To run the desktop version on Windows, Linux, (Mac OS?) you only need to install the JVM.
    On the server, you can arrange it as an applet or JWS (do you have to decide on a thin client?).
  2. Write a JavaEE web application that runs on GlassFish for example.
    The desktop version is proposed to be done as follows: run the local GlassFish server on which our application is running. Looks like some kind of artisanal method? A question of convenience for the user – installing and configuring the server, possible pitfalls?
  3. Write in PHP.
    Similar to point 2, with servers just kind of simpler?

This is a crazy question, but I would like to know your comments, what other options are there?
Previous topics:
Web Application Programming Language
Deploying Java applications on the server
Offline launch of web applications

Answer 1, authority 100%

I will supplement the answer with @ArtFeel. Adobe Flex + AIR is probably the only reasonable and affordable solution in your case. Below I share my personal experience in developing a solution with similar requirements.

You will get practically from the same code:

  • Desktop client (AIR).
  • Client for browser (Flash).
  • Client for communicators (Flash).

But there will be certain limitations of the architectural plan.

A web service in this case can be written on anything – its task will only be to receive and return data, PHP will do if there are time limits for mastering technologies. Personally, I would choose between a REST service in Java (Jersey) and a REST service in Ruby (Ruby On Rails), both options will allow you to quickly and easily make a service to perform CRUD operations, HTTPS in Java rises in 5 minutes. As a data transport – just XML or JSON (I would choose the second one).

The client will be “fat” – all application logic should be concentrated in it. In addition, in the client, you organize an abstract data access layer through which the application will read and write. For specific data sources, write appropriate implementations: for communicating with a web service, for local desktop storage, for local storage on mobile platforms. Depending on external conditions (from which platform it is launched and whether there is a connection with the server), the application includes a specific implementation of the data access layer.

Answer 2, authority 50%

Look at Adobe Air, it will allow you to write a cross-platform application not only on all desktop platforms, but also on iOS, and the web part on flash.