I think "why PHP over Java" has been already discussed in other questions, the question I have is:

What makes LAMP/WAMP stacks so cheap and abundant vs a Glassfish one? What are the prime factors behind this trend?

Also, Why has no java based light weight stack come up as a competitor?

  • 1
    Because nobody bothered to write one up? Could be a challenge for you!
    – Oded
    Oct 18, 2012 at 12:36
  • @Oded I'm asking for reasonable points, "web hosting market research" kind of points.
    – S.D.
    Oct 18, 2012 at 12:42
  • You are asking two questions in one. I was commenting about the second one. And both questions invite speculation - they are not really answerable.
    – Oded
    Oct 18, 2012 at 12:44
  • Bad question, faulty assumptions. Oct 18, 2012 at 14:26
  • One word - "WordPress"
    – jfrankcarr
    Oct 18, 2012 at 14:29

4 Answers 4


The answer is fairly simple: free market economics. There are lots of people looking for cheap PHP hosting and not a lot of people looking for cheap Glassfish hosting. This means more people will be willing to go in to the cheap PHP hosting business(less risk, more reward) than the cheap glassfish hosting business. This creates what is known as a virtuous cycle for PHP, more hosts means less risk for trying PHP, means more people looking for PHP hosts, and around it goes.

  • You probably meant "vicious cycle", not "virtuous", right? :) Oct 18, 2012 at 13:13
  • 3
    It would be a virtuous cycle for PHP(things get better because the status quo is better) and a vicious cycle for Java(things get worse because the status quo is worse).
    – stonemetal
    Oct 18, 2012 at 13:20

Why are Java servers so scarce and costly?

A: Java servers are usually used by large enterprises, thus are more complex and expected to be more costly than relatively simple applications built with LAMP. Also, Java is not primary used for web application but for middleware.

Also, Why has no java based light weight stack come up as a competitor ?

A: There is Groovy language based on the Java platform (runs on JVM) and Grails a web framework. It is very easily to be learned by Java programmers and very productive.

  • A/ctd: There is also Scala and Play!2, also easily learnt and very productive. There's also Clojure and Noir, again easily learnt and very productive. There's also JRuby and Rails, the #1 framework on the web! Apr 3, 2013 at 14:40

What happens here is the natural lifecycle of programming languages. The languages are innovative and disruptive at the beginning, than they become mainstream and than they slowly fade out while new and better suited alternatives arise.

Java kind of disrupted C/C++, PHP with Apache &co. ate a big portion of Java's market. But I personally think tha PHP is also over it's peak and the new languages like Ruby with Rails, or the functional programming wave, are coming fast.

So, I see C/C++ and Java being on their 'legacy' or 'phase out' portion of their lifecycle when no more extraordinary new features are added but the old ones are very stable and widely used.

PHP may be only a little after it's peak. It is still fast evolving, but the downward trend can already be observed.

  • 1
    Java ain't legacy; if your webapp is large enough then Java is the solution. Check at twitter for example, which migrated from Ruby to Java because Ruby simply is not so scalable.
    – Random42
    Oct 18, 2012 at 13:04
  • They didn't fully leave Ruby from what I've seen in their blogs and seem to have chosen Scala over Java. Correct me if I'm wrong...
    – Rig
    Oct 18, 2012 at 13:10
  • 1
    @patkos-csaba What language will take the place of Java after it fades ? PHP ? That will be a sad world. Oct 18, 2012 at 13:17
  • 1
    I can't see PHP replacing Java. PHP itself is in dire need of replacement. They're BOTH heading the way of COBOL at this point. Oct 18, 2012 at 14:27
  • @BrianKnoblauch especially with the advances the .NET framework is making in the web app area. I don't see Java fading quite like PHP will be. People will soon realize that they can do with Java what they can do with PHP. only a more scalable solution. I think the only way Java will fade is if something better comes along AND Oracle craps all over Java. But you're right, Java will be going the way of COBOL in the future...only being used by banks that don't want to pay to update their systems for decades :)
    – Randy E
    Oct 18, 2012 at 15:08

Because there is a perception that JEE containers are more "complicated", which implies more support calls and more admin training, which drives the prices up. So hosting a JSP-based site is more expensive, so more companies go with PHP. There are also a lot more ready-made tools and components for small business web sites (shopping carts, catalogs, etc) already written in PHP, so it's easy (read: cheap) for small companies to pull together a PHP-based site that does what they need, even if it's not as robust or scalable as a Java-based one.

Not the answer you're looking for? Browse other questions tagged or ask your own question.