Re: PHP vs. JSP

Discussion in 'Java' started by Wojtek, Aug 21, 2003.

  1. Wojtek

    Wojtek Guest

    On Wed, 20 Aug 2003 21:32:19 -0400, "John MacIntyre"
    <> wrote:

    >Hi,
    >
    >I am planning to move my web page onto a Linux server and will need to
    >rewrite my sites from ASP.
    >
    >I am at a crossroads on whether I should chose PHP or JSP. Or possibly even
    >something else.


    >Any input on each technology, or where I could find a non-biased comparison
    >would be greatly appreciated. Since, what ever I go with, I will probably
    >be sticking with for the next few years.


    ASP, PHP, and JSP are all intended to mix code with HTML.

    So ASP has HTML and Visual Basic code, JSP has HTML and Java code, and
    PHP has HTML and PHP code. All use some form of <% %> to contain the
    code.

    However, PHP can also be a standalone program with NO HTML, which is
    why it can be run from the command line, just like Java and Visual
    Basic.

    I have coded quite a bit in both PHP and JSP/Java. Both use a C like
    syntax.

    PHP is always interpreted (you CAN get PHP compilers, but you will
    need a special server process to run them). JSP's are compiled, and in
    fact become part of the Web application binary code.

    PHP is OK for small projects. By small I mean less complex, not fewer
    pages. The reason for this is that if you try to create a framework
    for your Web application, the amount of time it takes the PHP
    interpreter to process the frame work will swamp out the time it take
    for a particular page to run. For instance, in one of my trials, it
    took over 85% of the loading time of a page just to process the
    framework. Remember, PHP code is NOT resident in memory, so EVERY
    application service you need must be interpreted for EVERY page hit.

    On the other hand, a JSP page is usually run as part of an
    application. The application server loads the framework and holds it
    in memory. Then as each page request come through, the code for that
    page has all the framework resources available to it.

    So if you do multi-language sites, PHP must load the langauge specific
    text for each page hit (possibly loaded from a database - which
    happens for each page hit), while JSP/Java already has it resident in
    memory as a resource object (possibly loaded from a database during
    application startup - which happens once).

    PHP is not object oriented. Yes it has classes, but the implementation
    breaks a LOT of OOD concepts. It is more like the OO in Visual Basic.


    All that having been said, I prefer PHP for quick Web sites, and
    JSP/Java for more complex sites.
    ------------------------
    Wojtek Bok
    Solution Developer
     
    Wojtek, Aug 21, 2003
    #1
    1. Advertising

  2. "Wojtek" <> wrote in message
    news:...
    > On the other hand, a JSP page is usually run as part of an
    > application. The application server loads the framework and holds it
    > in memory. Then as each page request come through, the code for that
    > page has all the framework resources available to it.
    >
    > So if you do multi-language sites, PHP must load the langauge specific
    > text for each page hit (possibly loaded from a database - which
    > happens for each page hit), while JSP/Java already has it resident in
    > memory as a resource object (possibly loaded from a database during
    > application startup - which happens once).
    >


    Thanks Wojtek,

    JSP sounds to me like the way to go, but it sounds like JSP more resource
    intensive.

    Is JSP a resource hog?

    Thanks again,
    John MacIntyre
     
    John MacIntyre, Aug 22, 2003
    #2
    1. Advertising

  3. Wojtek

    Roedy Green Guest

    On Fri, 22 Aug 2003 21:02:13 GMT, Wojtek <> wrote or
    quoted :

    >If you change a JSP file, then the server will automatically compile
    >it. So the first user to hit that page will suffer a slight delay, but
    >all subsequent users will not. Or you can pre-compile the JSP.


    The key point to understand is the JSP page is NOT compiled on every
    request!

    The other point is that you can change the JSP code on the fly without
    taking down the server, or can you?



    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Aug 22, 2003
    #3
  4. Roedy,

    Roedy Green wrote:

    > On Fri, 22 Aug 2003 21:02:13 GMT, Wojtek <> wrote
    > or quoted :
    >
    >
    >> If you change a JSP file, then the server will automatically
    >> compile it. So the first user to hit that page will suffer a
    >> slight delay, but all subsequent users will not. Or you can
    >> pre-compile the JSP.

    >
    >
    > The key point to understand is the JSP page is NOT compiled on
    > every request!
    >
    > The other point is that you can change the JSP code on the fly
    > without taking down the server, or can you?


    You can. At least on the reference implementation, Tomcat. I believe
    it's commonly supported, if not mandated by the spec, but I'm too lazy
    to look it up right now.

    Randall Schulz

    > Canadian Mind Products, Roedy Green.
     
    Randall R Schulz, Aug 23, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    4,406
  2. Ted Zeng
    Replies:
    4
    Views:
    517
    Tim Arnold
    Oct 3, 2006
  3. Ted Zeng
    Replies:
    0
    Views:
    641
    Ted Zeng
    Oct 13, 2006
  4. torque63
    Replies:
    0
    Views:
    626
    torque63
    Jan 1, 2009
  5. Rajive Narain
    Replies:
    0
    Views:
    1,902
    Rajive Narain
    Sep 18, 2009
Loading...

Share This Page