PHP is the best solution on the entire web.. you can enjoy best OOP in PHP.. even Fb is developed on PHP.. not on java..
Websites of few large companies are built in Java who has deep pockets to hire professional Java programmers. For establishing budget friendly websites pup is much cheaper and can be combined with other enhancements.
You can't build a website with Java. I guess you're a beginner. Which language is easier? PHP. PHP is an easy-to-learn programming language but also good for experts.
No you said "You can't build a website with Java.". Which means NO. Both of your statements are incorrect. You can absolutely develop practically for the web in Java. There are many frameworks that simplify this and many enterprise level applications use Java. Even though it's a matter of opinion, one can easily argue that PHP is easier to get started and better suited for most small to medium tasks. However, to get the functionality that is found in enterprise level applications you most likely will be on a Framework like Zend, Laravel etc. And then one can easily argue that the learning curve is comparable to more complex languages. Hell I'll say more complex with PHP since the language is forgiving and will allow you to do some pretty silly things without error or warning.
Java can be used for both client and server side. Javascript as well: Node.JS and Angular, React or Vue.JS.
I don't know why it's needed to mention JavaScript as it has nothing to do with Java..which happens to be the topic...
It depends. If you want to make it cost effective then you can go for php. Otherwise if you want fully secured than go for java.
PHP's good for web development. It's powerful, easy to learn/use, easy to set up, safe, fast and has a good standard library. It is also supported by almost all hosting providers even free ones! The documentation for the language is superb. Java's good generic language which is useful for a great variety of applications. It can be used as a replacement for PHP, but that's going to be much more difficult.
I agree with most of what you say, but "safe" isn't one of the words I would use to describe PHP. There are hundreds, if not thousands of ways you can shoot yourself in the foot with PHP, because of the lax coding standards, and multiple ways of doing even the simplest things.
PHP is easy to code and there are lots of frameworks available in PHP, using which you can easily create websites at your own. Recently, I learned this course from YouTube. You can see also learn easily form here.
Learn both (best to include c++). PHP is fine for front end application, where there is a low processing. I help manage an application that gets over 300 billion events a month. The front end is fine with PHP, however, once you start having to process data and work on algorithms, it would be near impossible to keep them in PHP with data growth. The speed would be slow, very slow. Java comes into work on the backend where we have data processing and algorithms working as daemons. Initially we had those jobs in PHP, it was OK when we started as the traffic wasn't too high. Once we started hitting half of the 300, moving them to Java reduced the speed by an average of 300% (example php runs in 90-170 mins while java runs in 7), which is critical to our operations and saves us hundreds of thousands of dollars a day. Eventually we are planning on converting all PHP cronjobs to Java just for the speed alone. Even thou Facebook frontend is written in PHP, it is still converted to C++. Otherwise PHP itself will not be able to handle such traffic efficiently cutting costs down. Additionally, Facebook uses Erlang, Java and C++ for backend functionalities -which are the major components of facebook. Ex: recommendations, etc..