The two most significant differences are deployment models and hosting options.
As for deployment models, since PHP is (mostly) a language that is interpreted at the time of the request, the turnaround during development can be quite quick - you can easily make your in-place change behind the server, and your changes instantly as soon as you refresh your browser . On the contrary, Java can fall into a change cycle - a deployment that may take longer and also be more invasive (for example, a deployment may possibly exit your session).
Many of them can be mitigated using Java using various methods, various containers, third-party extensions (for example, JRebel), but you do not get this opportunity out of the box or from books on the shelf. I also do not want to replay it, the process is controlled, it is not so terrible. But this is the difference between the two platforms.
Hosting options come into play, since almost any random web host can host PHP applications at a certain level. PHP can be deployed as low CGI on saturated super cheap hosts for larger and more complex configurations.
Java MAY be deployed as a simple WAR for a shared host, and this works "OK", but shared Java environments may be less stable because different applications in a shared environment may be unfriendly to each other and have undue influence. This causes fewer problems when deploying PHP.
Therefore, most semi-rigid Java deployments instead use the VM instance as a standalone deployment. The game there will be to compare costs and such different options.
In general, I think that deploying Java is generally easier to manage and work due to the nature of packaging and the good tools Java servers work with, but it is a matter of taste and experience. Someone with a lot of PHP hosting and deployment experience rightly shrugs. But due to the fact that everything is new to someone, I think that it is much easier to work with Java.
source share