PHP vs. Java: Web Architecture
PHP vs. Java: Web Architecture
Java
*This document reflects my opinion about PHP and Java. I have written
this without any references. Let me know if there is a technical error.
--Hasari Tosun
It isn't correct to compare Java to PHP. Since PHP is a server-side scripting language whereas
Java is a general-purpose language. In other words, PHP is only used as a server-side language
where Java is both for server-side and desktop programming language. Moreover, Java is
compiled and strongly-typed language. On other hand, PHP is a dynamic typed language.
Hence, only for server-side programming, the comparison between Java and PHP makes sense.
In this paper, I am not discussing following two issues since each is currently hotly debated in
various communities:
Web Architecture
Web Architecture for PHP Programmer
Web Architecture for Java Programmer
Programmers
There are millions of bad programmers: Both Java and PHP programmers.
Everybody is a PHP programmer. Even monkeys! Almost all web hosting companies use
Apache Server/PHP.
Changing or creating a page in PHP is easy:
Updating a page: <?php echo “Hello Web” ?> to <?php echo “Hello Web 2.0” ?>
Creating a page: Use Drupal, WordPress, Xoops, Php-Nuke etc
For JSP (Java) it is also easy to change or create a page. However, for a complex
application, monkeys cannot do programming in Java.
Language features & libraries
Language Tools
Editors
- Java has many fabulous editors: Eclipse, Netbeans and Intellij. For the productivity and
the management of big project code, a complex editor is essential.
- PHP has a plug-in for Netbeans and Eclipse but very limited.
Debugging
- All Java editors allow you to debug your project within the editor.
- PHP debugging is just “print” statements.
Java Application servers enforce security model. Each application runs in its own
container.
Java/JVM has its own extensive security framework.
No security guarantees from PHP: Administrators run PHP in CGI mode in order to avoid
security nightmare. That is, PHP engine is forked for each page hit.
Even Administrator chroots (each time to you hit a page) for security.
Performance