Web has been developing for the second decade. Static HTML-pages have sunk in history and were replaced by the abstract WEB2 standard, the main requirement of which is interaction with the user. When I was working in custom software development company we discussed what is better PHP or Java.
PHP is considered a simple language. This is not surprising: from the textbook opening to the first "HelloWorld" takes no more than 5 minutes. On the one hand, it's good. But there are many pitfalls.
After spending a week studying PHP, you can learn basic input-output methods, primitive sampling from the database and a couple of other information processing algorithms. With the tasks complication, you want to reinvent the wheel based on old knowledge, making the code unreadable, destroying the possibility of further support at all.
Working with such a "coder" in the team, or worse, supporting the project written by him, turns into the everyday life of a school teacher. Naturally, this statement doesn't apply to everyone, but such a problem exists.
As for Java, the entry threshold is very high. Instead of "Installing LAMP under Ubuntu" and "Download the PHP tutorial", you need to understand the servlets, the interaction between them, jsp, learn how to work with some framework.
Plus OOP which in Java is mandatory. If we draw an analogy, the beginning of the work is comparable to higher mathematics.
This approach to language evaluation is not a panacea. A lot of serious projects are written based on PHP. Moreover, it dominates in the field of WEB-development.
One of the issues discussed in Java is long class and standard methods names. Only worth something the "System.out.println()" instead of "echo" on PHP. Of course, this is easily solved by the "import" at the beginning of the document or by the choice of a modern IDE where it's enough to write the first letter of the method or field, and after it will be possible to select the one from the list. However, it's biased to deny an impressive amount of Java code.
PHP is also not perfect. Take for example the mandatory dollar sign in front of the variable. Of course, the rational kernel of the difference between the notation of variables and methods (functions) is present. Personally, this causes a terrible headache. First of all, from the viewing of the sign itself.
And as for the hosting, PHP is common and cheaper than Java.