PHP speed vs HTML

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

    PHP speed vs HTML

    I need to make form on our front page. If using PHP, I suppose the full
    page must be PHP though I need none of the PHP features until the
    submit button is pressed.

    Only 3% of the users press the submit button of the form, remaining
    users do not use the form and have no benefit of PHP features.

    I also need a cookie to store the referrer, if using perl for the form
    submit, then javascript is the only alternative for cookie creation I
    suppose.

    With heavy traffic the page might become slower with PHP than if using
    HTML plus a cgi-bin perl?

  • Jerry Stuckle

    #2
    Re: PHP speed vs HTML

    Jan wrote:[color=blue]
    > I need to make form on our front page. If using PHP, I suppose the full
    > page must be PHP though I need none of the PHP features until the
    > submit button is pressed.
    >
    > Only 3% of the users press the submit button of the form, remaining
    > users do not use the form and have no benefit of PHP features.
    >
    > I also need a cookie to store the referrer, if using perl for the form
    > submit, then javascript is the only alternative for cookie creation I
    > suppose.
    >
    > With heavy traffic the page might become slower with PHP than if using
    > HTML plus a cgi-bin perl?
    >[/color]

    No, the whole page doesn't need to be PHP. PHP integrates with HTML
    quite well.

    But if they don't need PHP until they press the submit button, chances
    are the page your going *to* needs the PHP - not this one.

    BTW - PHP can also work with cookies.

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

    Comment

    • Justin Koivisto

      #3
      Re: PHP speed vs HTML

      Jerry Stuckle wrote:[color=blue]
      > Jan wrote:[color=green]
      >>
      >> With heavy traffic the page might become slower with PHP than if using
      >> HTML plus a cgi-bin perl?[/color]
      >
      > No, the whole page doesn't need to be PHP. PHP integrates with HTML
      > quite well.[/color]

      However, there is a small performance hit at the server end when the PHP
      interpreter is initiated to parse the file... Therefore, HTML will
      server faster by default. (Though you may never notice the difference
      without some heavy benchmarking.)

      --
      Justin Koivisto, ZCE - justin@koivi.co m

      Comment

      • Jan

        #4
        Re: PHP speed vs HTML

        We expect about 570 new visitors every minute on our web page, 17 of
        these will press the submit button to invoke the PHP.

        Would you expect the performance hit to noticeable at this volume, this
        we should consider a cgi-bin perl instead of PHP. Perl is never invoked
        unless submit is pressed.

        We would also like to store the referrer in a cookie when someone
        enters the page, this could be done with PHP. Maybe javascript is
        quicker?

        Comment

        • kay

          #5
          Re: PHP speed vs HTML

          u r expecting 400.000 visits a day? huh, nice

          u do it this way:

          homepage is your index.html with this code in the form tag

          <form action="form.ph p" method="post">
          FORM
          </form>

          so the home page IS NOT php.
          only the site that visitors see after clicking submit button will have
          php.

          so there's no way u will see any performance loss.

          Comment

          • Jerry Stuckle

            #6
            Re: PHP speed vs HTML

            Jan wrote:[color=blue]
            > We expect about 570 new visitors every minute on our web page, 17 of
            > these will press the submit button to invoke the PHP.
            >
            > Would you expect the performance hit to noticeable at this volume, this
            > we should consider a cgi-bin perl instead of PHP. Perl is never invoked
            > unless submit is pressed.
            >
            > We would also like to store the referrer in a cookie when someone
            > enters the page, this could be done with PHP. Maybe javascript is
            > quicker?
            >[/color]

            570 visitors a minute isn't a whole lot for a fast server. You won't
            see much impact by loading PHP. Of course, if you have a slow server,
            you'll see the impact - but there are many other things which will cause
            a bigger impact.

            BTW - Perl and PHP are both server-side languages and do much the same
            thing. You can design the PHP pages just like the Perl ones - and each
            parser will be invoked for its respective web page.

            As for the referrer - you would have to do that on the incoming page,
            which means PHP or Perl on the server side, or Javascript on the client
            side.

            However, this is VERY unreliable. The user may have disabled
            javascript, for instance. And even if they did, or you use PHP or Perl,
            HTTP_REFERER is not dependable. The browser may or may not send it, and
            even if they send it, a firewall may block it.


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

            Comment

            • F Laupretre

              #7
              Re: PHP speed vs HTML

              Le Wed, 01 Mar 2006 21:48:03 +0100, Jan <janoleolsen@ho tmail.com> a écrit:
              [color=blue]
              > We expect about 570 new visitors every minute on our web page, 17 of
              > these will press the submit button to invoke the PHP.
              >
              > Would you expect the performance hit to noticeable at this volume, this
              > we should consider a cgi-bin perl instead of PHP. Perl is never invoked
              > unless submit is pressed.
              >
              > We would also like to store the referrer in a cookie when someone
              > enters the page, this could be done with PHP. Maybe javascript is
              > quicker?
              >[/color]

              If you plan building a site with 400000 hits per day, may I suggest you to
              start reading some documentation about the underlying principles and
              architecture of web programming. Just to know how PHP, Javascript, cookies
              and, why not, cgi/perl, work in this kind of environment.

              Just to answer your question about perl : it won't be faster with perl
              than with PHP.

              And, for your information, NEVER ask a PHP programmer if it wouldn't be
              faster to use a Perl script ;-)

              François

              Comment

              • Chung Leong

                #8
                Re: PHP speed vs HTML

                Jan wrote:[color=blue]
                > I need to make form on our front page. If using PHP, I suppose the full
                > page must be PHP though I need none of the PHP features until the
                > submit button is pressed.
                >
                > Only 3% of the users press the submit button of the form, remaining
                > users do not use the form and have no benefit of PHP features.
                >
                > I also need a cookie to store the referrer, if using perl for the form
                > submit, then javascript is the only alternative for cookie creation I
                > suppose.
                >
                > With heavy traffic the page might become slower with PHP than if using
                > HTML plus a cgi-bin perl?[/color]

                Very unlikely, unless the script performs some sort of database
                operation. PHP can generate data far faster than the Internet can carry
                it. Most of the time PHP will just be waiting.

                Comment

                • Jan

                  #9
                  Re: PHP speed vs HTML

                  If I understand correctly, this means that the PHP parser is not loaded
                  until submit is pressed by the users, given that the cookie part is
                  done with javascript. Thus we may have a speedy and static HTML form
                  page where PHP is not invoked until form is submitted. I suppose method
                  can be submit just as well as post in the example above?

                  In this scenario I may try out PHP for cookies, and if it's slowing
                  down the site, try out javascript.

                  Comment

                  • Mladen Gogala

                    #10
                    Re: PHP speed vs HTML

                    On Wed, 01 Mar 2006 11:21:40 -0800, Jan wrote:
                    [color=blue]
                    > I need to make form on our front page. If using PHP, I suppose the full
                    > page must be PHP though I need none of the PHP features until the
                    > submit button is pressed.
                    >
                    > Only 3% of the users press the submit button of the form, remaining
                    > users do not use the form and have no benefit of PHP features.
                    >
                    > I also need a cookie to store the referrer, if using perl for the form
                    > submit, then javascript is the only alternative for cookie creation I
                    > suppose.
                    >
                    > With heavy traffic the page might become slower with PHP than if using
                    > HTML plus a cgi-bin perl?[/color]

                    Architecturally , PHP can not be slower as PHP interpreter is usually
                    a part of the httpd process while to call CGI one has to create a new
                    proces. You're avoiding context switches, process creation/manipulation,
                    signal dispatch and all those beautiful things. In addition to that, perl
                    is more complex, due to its more complex syntax. PHP is much simpler,
                    which means that the interpreter is much smaller.

                    --


                    Comment

                    Working...