Advantages and disadvantages of PHP?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jonathan Sachs

    Advantages and disadvantages of PHP?

    I'm a programmer learning PHP. I'm looking for some input on its
    strong and weak points compared to other server-side programming
    environments, e.g., Java Server Pages.

    Please note, this is not a religious question. Programming languages
    are tools to me. I just want information about where different types
    of solutions are likely to be optimal.
  • McKirahan

    #2
    Re: Advantages and disadvantages of PHP?

    "Jonathan Sachs" <js070717@sbcgl obal.netwrote in message
    news:drdgr3h9bi 2qfetppumbqjb8c pc0apji8q@4ax.c om...
    I'm a programmer learning PHP. I'm looking for some input on its
    strong and weak points compared to other server-side programming
    environments, e.g., Java Server Pages.
    >
    Please note, this is not a religious question. Programming languages
    are tools to me. I just want information about where different types
    of solutions are likely to be optimal.
    Take your pick: PHP, ASP, ASP.NET, Perl, Python, Java, et.al.

    What does your Web server support? What languages do you know?

    The answer usually boils down to the above.

    What Every Webmaster Should Know: PHP, Perl, ASP.net
    Ted Ulle gets up at the podium and welcomes every body. Adam Young is first up, WMW PHP mod forum. He explains that you can do anything with scripting. It is more important to know what you want done, versus saying you need scripting....



    Comment

    • The Natural Philosopher

      #3
      Re: Advantages and disadvantages of PHP?

      McKirahan wrote:
      "Jonathan Sachs" <js070717@sbcgl obal.netwrote in message
      news:drdgr3h9bi 2qfetppumbqjb8c pc0apji8q@4ax.c om...
      >I'm a programmer learning PHP. I'm looking for some input on its
      >strong and weak points compared to other server-side programming
      >environments , e.g., Java Server Pages.
      >>
      >Please note, this is not a religious question. Programming languages
      >are tools to me. I just want information about where different types
      >of solutions are likely to be optimal.
      >
      Take your pick: PHP, ASP, ASP.NET, Perl, Python, Java, et.al.
      >
      What does your Web server support? What languages do you know?
      >
      The answer usually boils down to the above.
      >
      What Every Webmaster Should Know: PHP, Perl, ASP.net
      Ted Ulle gets up at the podium and welcomes every body. Adam Young is first up, WMW PHP mod forum. He explains that you can do anything with scripting. It is more important to know what you want done, versus saying you need scripting....

      >
      >
      And as usual, what fits your style and the application is better than
      what is the Best Thing..


      Coming from C I found PHP mainly good, but irritating because of weak
      typing and inconsistency of syntax..this isn't a fault per se, just
      something you have to be equally careful of as you do in wobbly if you
      do operations on different types. In PHP they are invisibly converted
      with sometimes unexpected results.

      Its more than good enough for what I want tho..


      Comment

      • Gilles Ganault

        #4
        Re: Advantages and disadvantages of PHP?

        On Sun, 17 Feb 2008 07:38:50 -0600, Jonathan Sachs
        <js070717@sbcgl obal.netwrote:
        >I'm a programmer learning PHP. I'm looking for some input on its
        >strong and weak points compared to other server-side programming
        >environments , e.g., Java Server Pages.
        First, are you totally free to choose a language, or are there some
        constraint somewhere that would narrow things down? For instance, if
        you'll host your app on a shared server, just about every hoster
        offers PHP, while other languages are much more rare.

        If you'll be using your own server, you'll have to check if the app
        has any dependency, in which case you'll have to check if those
        externalities can be called from the language.

        Finally, what language do you already know? In terms of productivity,
        Python is probably the best, because it's very rich while offering a
        very simple syntax, while PHP is much more common simply because it's
        been offered by hosters for about ten years now.

        The web is pretty restrictive in what you can do compared to desktop
        apps anyway, because of the nature of HTTP and HTML, so ultimately,it
        doesn't make much of a difference what language you choose on the
        server. You can probably even write most of it in JavaScript and call
        routines from the client through AJAX :-)

        Comment

        • Betikci Boris

          #5
          Re: Advantages and disadvantages of PHP?

          On Feb 17, 3:38 pm, Jonathan Sachs <js070...@sbcgl obal.netwrote:
          I'm a programmer learning PHP. I'm looking for some input on its
          strong and weak points compared to other server-side programming
          environments, e.g., Java Server Pages.
          >
          Please note, this is not a religious question. Programming languages
          are tools to me. I just want information about where different types
          of solutions are likely to be optimal.
          As you asked for optimization, here is a list that i made, considering
          investment & operational cost, and time saving features, etc. Ofcourse
          i suggest open source, big companies like yahoo, google, nasa,
          youtube, facebook,etc. use;

          1-Python
          2-PHP
          3-Perl
          4-Java

          Comment

          • Gilles Ganault

            #6
            Re: Advantages and disadvantages of PHP?

            On Sun, 17 Feb 2008 16:23:34 GMT, Jonathan Sachs
            <js070717@sbcgl obal.netwrote:
            >I'll repeat that I'm guessing here. My guess is based on the fact
            >that PHP is (as far as I know) an interpreted language, while Java is
            >a JIT compiled language.
            Does someone have data on whether JIT-compiled Java is faster than
            cached PHP opcode?
            >The fact that Java and C# are strongly typed languages may also have
            >an effect on the scalability of applications, as well as their
            >robustness and maintainability .
            That's a good reason.

            Comment

            • The Natural Philosopher

              #7
              Re: Advantages and disadvantages of PHP?

              Jonathan Sachs wrote:
              >
              >
              Speaking technically, it seems to me that PHP is likely to be a poor
              choice for large-scale services where hundreds or thousands of users
              will be hitting the web site at the same time. I'm guessing, though,
              and I wouldn't know how to judge how large is too large. Perhaps
              there are other areas where PHP is particularly weak or strong, which
              I do not yet know enough to wonder about. Hence, my question.
              The current trend eems to be to throw processor power and RAM at such sites.

              If you have such, you probably would also have an Oracle Database
              underneath, not MySql :-)

              I picked PHP because I wanted fast prototyping of sonething running on a
              cheap platform, for moderate traffic only.

              Its actually pretty good. I am more bandwidth limited than processor
              bound, and probably RAM would be the first thing I would add.

              There is no doubt that writing in C would be immensely more efficient
              than an interpreter, but then you have the usual compile/link/install to
              do every time you make a change.

              However there is no reason why you could not pretty much recode any time
              critical bits into 'C'..r write a whole PHP library in 'C' that did your
              clever bits.*

              In the end execution efficiency is almost never a dominant issue..with
              PHP, MYSQL and Apache, especially on a Linux OS, you have an ideal
              platform that costs next to nothing to develop applications. A thousand
              concurrent users hitting it would probably cripple it sure, but by then
              you should have the money and the reason to migrate to something top
              end, if that's what's needed.

              I would regard the above as the de-facto standards for small to medium
              website development.

              *Where does one find out how to do this? I might need to one day...

              Comment

              • The Natural Philosopher

                #8
                Re: Advantages and disadvantages of PHP?

                Gilles Ganault wrote:
                On Sun, 17 Feb 2008 16:23:34 GMT, Jonathan Sachs
                <js070717@sbcgl obal.netwrote:
                >I'll repeat that I'm guessing here. My guess is based on the fact
                >that PHP is (as far as I know) an interpreted language, while Java is
                >a JIT compiled language.
                >
                Does someone have data on whether JIT-compiled Java is faster than
                cached PHP opcode?
                >
                >The fact that Java and C# are strongly typed languages may also have
                >an effect on the scalability of applications, as well as their
                >robustness and maintainability .
                >
                That's a good reason.
                As is the difficulty of ripping off the source if for some reason the
                3rd party server suddenly delivers pages of PHP source to you ;-)

                It happens..

                Comment

                • Jonathan Sachs

                  #9
                  Re: Advantages and disadvantages of PHP?

                  On Sun, 17 Feb 2008 14:16:25 -0500, Jerry Stuckle
                  <jstucklex@attg lobal.netwrote:
                  >You will find that often java is slower than PHP.
                  >
                  >Don't guess. Get the facts.
                  Can you refer me to a source of information on this, or at least
                  explain why it is so?

                  I value facts, but I do not have the ability to pull them out of thin
                  air. The value of USENET lies in the ability of like-minded people to
                  share information, so that each person does not have to reinvent or
                  rediscover the wheel for him or herself. Please share a little.

                  Comment

                  • Animesh K

                    #10
                    Re: Advantages and disadvantages of PHP?

                    Jonathan Sachs wrote:
                    <snip>
                    >
                    Speaking technically, it seems to me that PHP is likely to be a poor
                    choice for large-scale services where hundreds or thousands of users
                    will be hitting the web site at the same time. I'm guessing, though,
                    and I wouldn't know how to judge how large is too large. Perhaps
                    there are other areas where PHP is particularly weak or strong, which
                    I do not yet know enough to wonder about. Hence, my question.
                    I am not sure about the back-end, but at the front end, Facebook uses
                    Php and JS. Signing in takes you to the page below. Facebook's
                    popularity can be judged at Alexa.




                    Comment

                    • Jerry Stuckle

                      #11
                      Re: Advantages and disadvantages of PHP?

                      Jonathan Sachs wrote:
                      On Sun, 17 Feb 2008 14:16:25 -0500, Jerry Stuckle
                      <jstucklex@attg lobal.netwrote:
                      >
                      >You will find that often java is slower than PHP.
                      >>
                      >Don't guess. Get the facts.
                      >
                      Can you refer me to a source of information on this, or at least
                      explain why it is so?
                      >
                      I value facts, but I do not have the ability to pull them out of thin
                      air. The value of USENET lies in the ability of like-minded people to
                      share information, so that each person does not have to reinvent or
                      rediscover the wheel for him or herself. Please share a little.
                      >
                      Because they are two different approaches to programming. Just because
                      java is precompiled doesn't necessarily make it faster. There are many
                      other things to take into consideration.

                      As I said - run your own tests.

                      --
                      =============== ===
                      Remove the "x" from my email address
                      Jerry Stuckle
                      JDS Computer Training Corp.
                      jstucklex@attgl obal.net
                      =============== ===

                      Comment

                      • larry@portcommodore.com

                        #12
                        Re: Advantages and disadvantages of PHP?

                        On Feb 17, 5:38 am, Jonathan Sachs <js070...@sbcgl obal.netwrote:
                        I'm a programmer learning PHP. I'm looking for some input on its
                        strong and weak points compared to other server-side programming
                        environments, e.g., Java Server Pages.
                        >
                        Please note, this is not a religious question. Programming languages
                        are tools to me. I just want information about where different types
                        of solutions are likely to be optimal.
                        Advantages:
                        - Open Source, readily available (you can be using it today) and dual-
                        licensed - if you are doing non-profit work or not licensing, there is
                        no cost.
                        - Very Easy to understand Syntax, some really cool features (arrays
                        are something else!)
                        - Interfaces very easily with Apache/MySQL
                        - Server side (no need to futz with client installs - only with
                        rendering issues if you use CSS).
                        - Lots of good source code out there to use and/or learn from, as well
                        as many useful libraries for working with PDFs, graphics, etc.
                        - Lots of good books and on-line help (php.net is great)
                        - Platform agnostic, can run on Windows Linux or Mac servers. Also
                        very scalable.
                        - Lots of hosting services have it ready to use, no special
                        configuration (except if you have special security needs)
                        - Pretty easy to access other web-based tools through PHP (i.e. google
                        maps, etc.)

                        Disadvantages
                        - If you want to do more than just HTML/CSS pages on the client you
                        need to also add javascript, java or other client-side language in
                        your output (goes for Perl and some other languages).
                        - The way browsers work make handling data and coding programs more
                        interesting (technically each page is a new run on the system, so you
                        have to manage your variables coming in and going out and between
                        pages. Not hard, just different.)
                        - Web programming (regardless of language) is open to security flaws
                        due to unimplemented or unknown vulnerabilities , takes a bit more
                        caution.

                        Comment

                        • Gilles Ganault

                          #13
                          Re: Advantages and disadvantages of PHP?

                          On Mon, 18 Feb 2008 01:46:19 -0800 (PST), "C.
                          (http://symcbean.blogsp ot.com/)" <colin.mckinnon @gmail.comwrote :
                          >One of the most convincing arguments I've seen for PHP is the stats at
                          >http://shootout.alioth.debian.org/
                          So, in practise, what are the usual bottlenecks for PHP web apps?
                          Access to the DB? Hard-disk? CPU? Network?
                          I'd also be looking at Ants.
                          You mean www.ants.com ?
                          >Yes, I'd expect well crafted C (or even C++) to beat the socks off
                          >PHP, but who has got that amount of time to spend writing functional,
                          >secure code?
                          Besides, it'd be stupid to write very fast C code... but have the CPU
                          spend 99% of its time idle, waiting for bytes to travel in and out of
                          the network :-)

                          Comment

                          • Gilles Ganault

                            #14
                            Re: Advantages and disadvantages of PHP?

                            On Sun, 17 Feb 2008 22:01:12 -0800 (PST), larry@portcommo dore.com
                            wrote:
                            >- If you want to do more than just HTML/CSS pages on the client you
                            >need to also add javascript, java or other client-side language in
                            >your output (goes for Perl and some other languages).
                            Isn't that true for all server-side languages? The OP asked how PHP
                            compared to other languages used to build web apps, not PHP vs.
                            desktop languages.

                            Comment

                            • Jonathan Sachs

                              #15
                              Re: Advantages and disadvantages of PHP?

                              On Mon, 18 Feb 2008 01:46:19 -0800 (PST), "C.
                              (http://symcbean.blogsp ot.com/)" <colin.mckinnon @gmail.comwrote :
                              >One of the most convincing arguments I've seen for PHP is the stats at
                              >http://shootout.alioth.debian.org/
                              Perhaps I misunderstand something about these results. I displayed a
                              comparison of PHP to Java ("Java 6 -server"). Considering all of the
                              benchmarks shown, PHP had a small overall advantage in memory use and
                              Java had a large overall advantage in CPU time.

                              I'm not familiar with the benchmarks, but their names suggest to me
                              that most of them are CPU-intensive -- not representative of typical
                              server applications. Thus I'll take the results with a bit of salt.
                              They suggest to me that for typical "real" server-side applications,
                              neither language would have a clear advantage.

                              Comment

                              Working...