Why switch from Java to PHP?

A question from Yahoo! Answers:

Why php is being popular when it is not as safe as java,y som compnis sh\witching from java platform to php ?

First of all, what do you mean when you say “Java”? Is it Tomcat, JBOSS, PowerTier, WebLogic, WebSphere, something else?

Second, PHP is just as safe as any other Web application development language. Security is most often compromised by programmers writing bad code, not by PHP or JSP themselves. Since PHP is much easier to learn, there are more inexperienced programmers working with it, hence, security issues in some PHP applications.

Third, why do some companies switch from Java to PHP? Cost and performance. Consider Friendster. The company started on Apache / Tomcat / MySQL platform, but quickly ran into severe performance issues. The fault lay somewhere between Tomcat and MySQL JDBC driver; somehow, at high loads, the two didn’t want to play nicely with each other. So the options were:

  1. To replace Tomcat with a more powerful JSP server, which will be somewhat expensive and may or may not work better with MySQL.
  2. To replace MySQL with a more powerful database server (most likely, Oracle, which has a great track record of working with JSP servers), but that may or may not resolve issues with Tomcat cracking under pressure and will definitely be expensive.
  3. Do 1 and 2 simultaneously, but this is going to be even more expensive than 2 alone.
  4. Rewrite the front end in a more MySQL-friendly language, such as PHP.

Friendster chose option 4 and did not regret it.

Fourth, PHP is not the only alternative for those dissatisfied with Java’s poor performance. Python is becoming increasingly popular as well…

This entry was posted in Answers, Technology. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *