skip to content

Hosting

PHP allows hosting on almost any web server (apache, nginx, etc), and most web hosts offer shared hosting for PHP. Java, on the other hand, requires the installation of a "servlet container". Many free and easy-to-implement solutions exist - like Tomcat - but often require the installation of a specific server.

.

In conclusion: for projects with a low budget or that must remain free, PHP seems more indicated, because hosting is simpler to set up.

Best choice: PHP

Learning

PHP is a language designed for the internet. Adding a small piece of PHP code into a web page to create a dynamic part of it turns out to be very simple. This is the reason why people starting from scratch or wanting to learn development willingly start with PHP, as the results are immediately noticeable. On the other hand, Java requires at least a good understanding of object-oriented programming, which is difficult for a neophyte.

Best choice: PHP

Community / Resources / Interoperability

PHP and JAVA are extremely popular languages with many resources and a very large community. But while it is on par with JAVA in the "websites" department, PHP is only present in this branch. JAVA is used in almost all areas of computing, which allows a great interoperability. It is for example the base of the Android system, present on most smartphones in the world. This results in it being easier to find a Java developer than PHP.

The IEEE is an organization that tracks the amount of research done on either language, online information/resource sharing, and social activity around the various programming languages.

Comparison of entries in development support sites (2018)
Best choice: JAVA

Security

JAVA validates data at every step of the process, making it almost impossible for injection attacks to occur, and thus proving to be a significant security asset. On the PHP side, data control and validation are the prerogative of the developer, where JAVA includes them directly in the core of the language.

Best choice: JAVA

Performance

Before being executed, JAVA code is "compiled," that is, written and transformed by the developer to make it easier for a machine to read. An aspect that makes JAVA applications perform better than their PHP counterparts. To verify this, we conducted a simple experiment, installing on a single machine several CMS based on different languages and sending thousands of requests to the said site without further configuration. Here is the result of this test:

Charge on CMS "Out of the box" (2014)
Best choice: JAVA

Maintenance

Java guarantees bottom-up language accounting. In practice, whatever the project, it will be possible to perform an update without problems and no one a worry. In PHP on the other hand, the updates of major version can generate problems in the application. Moreover, because of the "compiled" profile of the PHP language, for a problem to occur, the code must be executed by the site visitor. Therefore, numerous user tests will be required at each version update.

Java uses a "packaging" mechanism. The web application is "packaged" in a ZIP file (with the extension .war), when PHP simply deploys the files to the server. The JAVA approach is better for large business updates, as it ensures that all files are from the same version and will be compatible with each other. In contrast, PHP complicates global updates more than simple updates or minor fixes, which here can be done directly on the file in the application.

Best choice: JAVA (except small project)