PHP allows hosting on almost all web servers (apache, nginx ...). Most web hosts offer shared hosting for PHP.
Java, however, requires the installation of a "Servlet Container", there is a lot of "Servlet Container" free and easy to implement as tomcat, but it often requires the installation of a specific server.
Conclusion : for low-cost projects or should remain "free" PHP seems more appropriate because hosting is easier to implement.
Best choices: PHP