htm vs. php problem

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

    htm vs. php problem

    The company I work for uses .htm extensions with their php code. There
    is one page which has quite a few querys that I am having problems
    with. With the .htm extension it will take 30+ seconds to load the
    page and, for example, will pull approx 30 rows from the db. If I just
    change the extension to .php, it takes less than 1 second to load the
    same page, and will pull over 300 rows from the db. Any ideas why this
    is happening?

  • Ivan Marsh

    #2
    Re: htm vs. php problem

    On Mon, 18 Dec 2006 08:24:30 -0800, Andrew wrote:
    The company I work for uses .htm extensions with their php code. There
    is one page which has quite a few querys that I am having problems
    with. With the .htm extension it will take 30+ seconds to load the
    page and, for example, will pull approx 30 rows from the db. If I just
    change the extension to .php, it takes less than 1 second to load the
    same page, and will pull over 300 rows from the db. Any ideas why this
    is happening?
    A man goes to the doctor and says: "Doc, It hurts when I do this..."

    Comment

    • Andrew

      #3
      Re: htm vs. php problem


      Ivan Marsh wrote:
      On Mon, 18 Dec 2006 08:24:30 -0800, Andrew wrote:
      >
      The company I work for uses .htm extensions with their php code. There
      is one page which has quite a few querys that I am having problems
      with. With the .htm extension it will take 30+ seconds to load the
      page and, for example, will pull approx 30 rows from the db. If I just
      change the extension to .php, it takes less than 1 second to load the
      same page, and will pull over 300 rows from the db. Any ideas why this
      is happening?
      >
      A man goes to the doctor and says: "Doc, It hurts when I do this..."
      Ivan, I know what you are saying...but going with .php extensions is
      out of my control. Any suggestions I can bring up to them to why this
      happens?

      Comment

      • Erwin Moller

        #4
        Re: htm vs. php problem

        Andrew wrote:
        The company I work for uses .htm extensions with their php code. There
        is one page which has quite a few querys that I am having problems
        with. With the .htm extension it will take 30+ seconds to load the
        page and, for example, will pull approx 30 rows from the db. If I just
        change the extension to .php, it takes less than 1 second to load the
        same page, and will pull over 300 rows from the db. Any ideas why this
        is happening?
        Hi Andrew,

        That is strange indeed.
        One would expect that this makes little difference indeed.

        Please give us some more info.
        Are you using a real httpserver (Apache eg)? Or is this happening on IIS?

        Will a .htm extension of any request to the server fire additional processes
        for parsing? (Some excotic CMS maybe that fiddles around?)
        Some (broken) caching mechanism at work maybe for htm-extension only and not
        for phpextension?

        I can only guess.

        Whatever the reason, I think something is set up awkwardly in your company.
        If you feel adventurous, fix it.

        And of course, stopping to use html extension to execute PHP makes sense
        too...
        Use .php for php. Why change such a thing?

        Regards,
        Erwin Moller

        Comment

        • Ivan Marsh

          #5
          Re: htm vs. php problem

          On Mon, 18 Dec 2006 08:46:31 -0800, Andrew wrote:
          Ivan Marsh wrote:
          >On Mon, 18 Dec 2006 08:24:30 -0800, Andrew wrote:
          >>
          The company I work for uses .htm extensions with their php code.
          There is one page which has quite a few querys that I am having
          problems with. With the .htm extension it will take 30+ seconds to
          load the page and, for example, will pull approx 30 rows from the db.
          If I just change the extension to .php, it takes less than 1 second
          to load the same page, and will pull over 300 rows from the db. Any
          ideas why this is happening?
          >>
          >A man goes to the doctor and says: "Doc, It hurts when I do this..."
          >
          Ivan, I know what you are saying...but going with .php extensions is out
          of my control. Any suggestions I can bring up to them to why this
          happens?
          I'm wondering how any of your code is being processed at all. The
          webserver knows what pre-processor to send a page through based on its
          extension.

          If your PHP code is being processed in a .htm file then the webserver must
          be set up to send .htm files through the PHP pre-processor. Which mean all
          of your webpages are being sent through the pre-processor whether they
          have any code to process in them or not. Needless to say this is causing a
          greatly increased load on your webserver.

          I'm sorry that I don't have any constructive ideas about the difference in
          performance but it's difficult to troubleshoot an issue that is obviously
          being caused by a webserver that has been, evidently, purposefully
          incorrectly configured.

          The one thing that I can think of, depending on what webserver you're
          running, is that it might be confused as to what language it's seeing when
          you run a script based on what languages that webserver processes by
          default.

          I'd suggest if you're using the short tags <? to try the long tags <?php
          and see if that straightens it out.




          Comment

          • Andrew

            #6
            Re: htm vs. php problem

            We are using:
            Apache v.1.3.37
            PHP v.4.4.3

            Comment

            • Peter Fox

              #7
              Re: htm vs. php problem

              Following on from Andrew's message. . .
              >We are using:
              >Apache v.1.3.37
              >PHP v.4.4.3
              And Management v 0.0


              Say that you asked on comp.lang.php and you were "told" you *had* to
              upgrade to Apache 2.x *and* PHP 5.x to deal with this problem ... (That
              should give the twerps the willies)
              .... Or they could just use the php extension and whenever they felt like
              making a decision would they let you know what it was.

              --
              PETER FOX Not the same since the bookshop idea was shelved
              peterfox@eminen t.demon.co.uk.n ot.this.bit.no. html
              2 Tees Close, Witham, Essex.
              Gravity beer in Essex <http://www.eminent.dem on.co.uk>

              Comment

              • Ivan Marsh

                #8
                Re: htm vs. php problem

                On Mon, 18 Dec 2006 18:17:30 +0000, Peter Fox wrote:
                Following on from Andrew's message. . .
                >>We are using:
                >>Apache v.1.3.37
                >>PHP v.4.4.3
                And Management v 0.0
                >
                >
                Say that you asked on comp.lang.php and you were "told" you *had* to
                upgrade to Apache 2.x *and* PHP 5.x to deal with this problem ... (That
                should give the twerps the willies)
                ... Or they could just use the php extension and whenever they felt like
                making a decision would they let you know what it was.
                Been fired much?

                Comment

                • Peter Fox

                  #9
                  Re: htm vs. php problem

                  Following on from Ivan Marsh's message. . .
                  >On Mon, 18 Dec 2006 18:17:30 +0000, Peter Fox wrote:
                  >
                  >Following on from Andrew's message. . .
                  >>>We are using:
                  >>>Apache v.1.3.37
                  >>>PHP v.4.4.3
                  >And Management v 0.0
                  >>
                  >>
                  >Say that you asked on comp.lang.php and you were "told" you *had* to
                  >upgrade to Apache 2.x *and* PHP 5.x to deal with this problem ... (That
                  >should give the twerps the willies)
                  >... Or they could just use the php extension and whenever they felt like
                  >making a decision would they let you know what it was.
                  >
                  >Been fired much?
                  >
                  In 35 years of computing I have never regretted telling people that it
                  doesn't matter how much they dislike the facts : "2 plus 2 does not
                  equal 3" The more they huff and puff the more they /are afraid/ of your
                  knowledge. Don't work for those people - Full stop. Another thing you
                  should remember is that good programmers don't get promoted, they move
                  to a better job elsewhere. (Mediocre programmers get a job title 'team
                  leader' and crap programmers become managers.)



                  --
                  PETER FOX Not the same since the bookshop idea was shelved
                  peterfox@eminen t.demon.co.uk.n ot.this.bit.no. html
                  2 Tees Close, Witham, Essex.
                  Gravity beer in Essex <http://www.eminent.dem on.co.uk>

                  Comment

                  • Andrew

                    #10
                    Re: htm vs. php problem


                    Ivan Marsh wrote:
                    On Mon, 18 Dec 2006 08:46:31 -0800, Andrew wrote:
                    >
                    Ivan Marsh wrote:
                    On Mon, 18 Dec 2006 08:24:30 -0800, Andrew wrote:
                    >
                    The company I work for uses .htm extensions with their php code.
                    There is one page which has quite a few querys that I am having
                    problems with. With the .htm extension it will take 30+ seconds to
                    load the page and, for example, will pull approx 30 rows from the db.
                    If I just change the extension to .php, it takes less than 1 second
                    to load the same page, and will pull over 300 rows from the db. Any
                    ideas why this is happening?
                    >
                    A man goes to the doctor and says: "Doc, It hurts when I do this..."
                    Ivan, I know what you are saying...but going with .php extensions is out
                    of my control. Any suggestions I can bring up to them to why this
                    happens?
                    >
                    I'm wondering how any of your code is being processed at all. The
                    webserver knows what pre-processor to send a page through based on its
                    extension.
                    >
                    If your PHP code is being processed in a .htm file then the webserver must
                    be set up to send .htm files through the PHP pre-processor. Which mean all
                    of your webpages are being sent through the pre-processor whether they
                    have any code to process in them or not. Needless to say this is causing a
                    greatly increased load on your webserver.
                    >
                    I'm sorry that I don't have any constructive ideas about the difference in
                    performance but it's difficult to troubleshoot an issue that is obviously
                    being caused by a webserver that has been, evidently, purposefully
                    incorrectly configured.
                    >
                    The one thing that I can think of, depending on what webserver you're
                    running, is that it might be confused as to what language it's seeing when
                    you run a script based on what languages that webserver processes by
                    default.
                    >
                    I'd suggest if you're using the short tags <? to try the long tags <?php
                    and see if that straightens it out.
                    That was it. The short tags were causing the problem. Unfortunely, the
                    code on other pages are littered with them as well. I guess we have a
                    lot of work to do. Plus now I have to try to convince them to lose the
                    ..htm and make some upgrades. I've only been with the company for a
                    month, so hopefully they will hear me out. Thank you everyone for your
                    input.

                    Comment

                    • Ivan Marsh

                      #11
                      Re: htm vs. php problem

                      On Mon, 18 Dec 2006 19:20:23 +0000, Peter Fox wrote:
                      Following on from Ivan Marsh's message. . .
                      >>On Mon, 18 Dec 2006 18:17:30 +0000, Peter Fox wrote:
                      >>
                      >>Following on from Andrew's message. . .
                      >>>>We are using:
                      >>>>Apache v.1.3.37
                      >>>>PHP v.4.4.3
                      >>And Management v 0.0
                      >>>
                      >>>
                      >>Say that you asked on comp.lang.php and you were "told" you *had* to
                      >>upgrade to Apache 2.x *and* PHP 5.x to deal with this problem ...
                      >>(That should give the twerps the willies) ... Or they could just use
                      >>the php extension and whenever they felt like making a decision would
                      >>they let you know what it was.
                      >>
                      >>Been fired much?
                      >>
                      In 35 years of computing I have never regretted telling people that it
                      doesn't matter how much they dislike the facts : "2 plus 2 does not
                      equal 3" The more they huff and puff the more they /are afraid/ of your
                      knowledge. Don't work for those people - Full stop. Another thing you
                      should remember is that good programmers don't get promoted, they move
                      to a better job elsewhere. (Mediocre programmers get a job title 'team
                      leader' and crap programmers become managers.)
                      I don't see anything factual about the suggestion you made. Even with
                      those upgrades the original issue would still exist.

                      The only thing to tell them is that processing .htm files as anything
                      other than HTML files is simply not right.

                      They need to un-break their webserver.

                      Comment

                      • Allodoxaphobia

                        #12
                        Re: htm vs. php problem

                        On Mon, 18 Dec 2006 13:54:33 -0600, Ivan Marsh wrote:
                        The only thing to tell them is that processing .htm files as anything
                        other than HTML files is simply not right.
                        >
                        They need to un-break their webserver.
                        I fear that if those truly are ".htm" files, they already had/have a
                        b0rk3n webserver.

                        Jonesy

                        Comment

                        • John Dunlop

                          #13
                          Re: htm vs. php problem

                          Ivan Marsh:
                          The only thing to tell them is that processing .htm files as anything
                          other than HTML files is simply not right.
                          Why?

                          --
                          Jock

                          Comment

                          • Petr Vileta

                            #14
                            Re: htm vs. php problem

                            "Andrew" <aiithak@gmail. compíse v diskusním príspevku
                            news:1166459070 .060246.38360@j 72g2000cwa.goog legroups.com...
                            The company I work for uses .htm extensions with their php code. There
                            is one page which has quite a few querys that I am having problems
                            with. With the .htm extension it will take 30+ seconds to load the
                            page and, for example, will pull approx 30 rows from the db. If I just
                            change the extension to .php, it takes less than 1 second to load the
                            same page, and will pull over 300 rows from the db. Any ideas why this
                            is happening?
                            >
                            Maybe you have bad configured server. If you use Apache then search some
                            like this

                            <IfModule mod_php4.c>
                            AddType application/x-httpd-php .php .php4 .php3 .phtml
                            AddType application/x-httpd-php-source .phps
                            </IfModule>

                            and add there .htm extension too.
                            <IfModule mod_php4.c>
                            AddType application/x-httpd-php .php .php4 .php3 .phtml .htm
                            AddType application/x-httpd-php-source .phps
                            </IfModule>

                            But be carefull then other realy static html pages have different extension
                            eg. .html.

                            --

                            Petr Vileta, Czech republic
                            (My server rejects all messages from Yahoo and Hotmail. Send me your mail
                            from another non-spammer site please.)


                            Comment

                            • Toby Inkster

                              #15
                              Re: htm vs. php problem

                              Andrew wrote:
                              That was it. The short tags were causing the problem. Unfortunely, the
                              code on other pages are littered with them as well. I guess we have a
                              lot of work to do.
                              Search and replace -- easy.

                              --
                              Toby A Inkster BSc (Hons) ARCS
                              Contact Me ~ http://tobyinkster.co.uk/contact

                              Comment

                              Working...