mysql apache - page never finish loading

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • theGreatGnu@my-deja.com

    #1

    mysql apache - page never finish loading


    Hi all,

    I am new to PHP, Apache and Mysql. But I least I have managed to
    install everything on my home computer on my own and everything is up
    and running. I can fetch data from the database and display it. So far,
    so good.

    However, I'm stuck on an irritating problem. Whenever I connect to
    mysql, my PHP pages don't want to finish loading. In the following
    example, the page will not finish loading nor display "abc" until I
    interupt by pressing "Stop" in the web browser".

    <?php
    echo 'a';
    $link = mysql_connect(' localhost', 'user', 'pwd');
    echo 'b';
    mysql_close($li nk);
    echo 'c';
    ?>

    I am running Apache 2.2.2 and Mysql 5.0.

    Any help appreciated.

    -Anders Bondensson

  • Alvaro G. Vicario

    #2
    Re: mysql apache - page never finish loading

    *** theGreatGnu@my-deja.com escribió/wrote (8 Jul 2006 03:22:00 -0700):
    However, I'm stuck on an irritating problem. Whenever I connect to
    mysql, my PHP pages don't want to finish loading. In the following
    example, the page will not finish loading nor display "abc" until I
    interupt by pressing "Stop" in the web browser".
    >
    <?php
    echo 'a';
    $link = mysql_connect(' localhost', 'user', 'pwd');
    echo 'b';
    mysql_close($li nk);
    echo 'c';
    ?>
    Your code looks flawless to me. I'd say the problem could be in third-party
    software, such as:

    - Antivirus
    - Firewall
    - Proxy
    ....

    If you are using Windows, there's an Apache directive you can try (add it
    to httpd.conf file):

    EnableSendfile Off
    EnableMMAP Off
    Win32DisableAcc eptEx

    This seems to fix some Windows specific problems. If it works for you
    please let me know.


    --
    -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
    ++ Mi sitio sobre programación web: http://bits.demogracia.com
    +- Mi web de humor con rayos UVA: http://www.demogracia.com
    --

    Comment

    • theGreatGnu@my-deja.com

      #3
      Re: mysql apache - page never finish loading


      Alvaro G. Vicario skrev:
      *** theGreatGnu@my-deja.com escribió/wrote (8 Jul 2006 03:22:00 -0700):
      However, I'm stuck on an irritating problem. Whenever I connect to
      mysql, my PHP pages don't want to finish loading. In the following
      example, the page will not finish loading nor display "abc" until I
      interupt by pressing "Stop" in the web browser".

      <?php
      echo 'a';
      $link = mysql_connect(' localhost', 'user', 'pwd');
      echo 'b';
      mysql_close($li nk);
      echo 'c';
      ?>
      >
      Your code looks flawless to me. I'd say the problem could be in third-party
      software, such as:
      >
      - Antivirus
      - Firewall
      - Proxy
      ...
      >
      If you are using Windows, there's an Apache directive you can try (add it
      to httpd.conf file):
      >
      EnableSendfile Off
      EnableMMAP Off
      Win32DisableAcc eptEx
      >
      This seems to fix some Windows specific problems. If it works for you
      please let me know.
      Thank for your help. Unfortunately this did not fix the problem. I have
      added the above lines to the httpd.conf file, i have inactivated both
      firewall and anti virus, all in various combinations. Not sure what to
      do with the proxy server. Don't think I am using one, but I could be
      mistaken.

      Opera and IE behaves somewhat differently. With Opera, the "abc" will
      be displayed when I press "stop" in the browser. For IE, "abc" will
      never be displayed. The page will just not load.

      All this happens whenver I connect to mysql. Regular html or php pages
      will load happily.

      -Anders Bondensson

      Comment

      • flamer die.spam@hotmail.com

        #4
        Re: mysql apache - page never finish loading

        i would stick in an ' or die (mysql_error ()); ' at the end of the
        statement, probably is coming across an error but for some reason keeps
        trying.. you really should have that on all your sql queries.

        Flamer.

        theGreatGnu@my-deja.com wrote:
        Alvaro G. Vicario skrev:
        >
        *** theGreatGnu@my-deja.com escribió/wrote (8 Jul 2006 03:22:00 -0700):
        However, I'm stuck on an irritating problem. Whenever I connect to
        mysql, my PHP pages don't want to finish loading. In the following
        example, the page will not finish loading nor display "abc" until I
        interupt by pressing "Stop" in the web browser".
        >
        <?php
        echo 'a';
        $link = mysql_connect(' localhost', 'user', 'pwd');
        echo 'b';
        mysql_close($li nk);
        echo 'c';
        ?>
        Your code looks flawless to me. I'd say the problem could be in third-party
        software, such as:

        - Antivirus
        - Firewall
        - Proxy
        ...

        If you are using Windows, there's an Apache directive you can try (add it
        to httpd.conf file):

        EnableSendfile Off
        EnableMMAP Off
        Win32DisableAcc eptEx

        This seems to fix some Windows specific problems. If it works for you
        please let me know.
        >
        Thank for your help. Unfortunately this did not fix the problem. I have
        added the above lines to the httpd.conf file, i have inactivated both
        firewall and anti virus, all in various combinations. Not sure what to
        do with the proxy server. Don't think I am using one, but I could be
        mistaken.
        >
        Opera and IE behaves somewhat differently. With Opera, the "abc" will
        be displayed when I press "stop" in the browser. For IE, "abc" will
        never be displayed. The page will just not load.
        >
        All this happens whenver I connect to mysql. Regular html or php pages
        will load happily.

        -Anders Bondensson

        Comment

        • Mel

          #5
          Re: mysql apache - page never finish loading

          On 2006-07-10 10:00:41 +1000, "flamer die.spam@hotmai l.com"
          <die.spam@hotma il.comsaid:
          i would stick in an ' or die (mysql_error ()); ' at the end of the
          statement, probably is coming across an error but for some reason keeps
          trying.. you really should have that on all your sql queries.
          >
          Flamer.

          I'm curious: why should you always have one on SQL function calls? I
          never use them and opt for things like:

          $link = @mssql_connect( CONNECTION_STUF F_HERE);
          if ($link === false) {
          // handle error
          }
          if (@mssql_select_ db(DBNAME,$link ) === false) {
          // handle error
          }
          $sql = "select * from myTable";
          $res = @mssql_query($r es);
          if ($res === false) {
          // handle error
          }

          Normally this'd be in a class and '// handle error' would throw an
          Exception. This method is used heavily in my production environment and
          has yet to fail me. I'm not poo-pooing the idea of the die() or exit()
          functions inline with the SQL functions, just wondering why they should
          be used.

          Comment

          • Jerry Stuckle

            #6
            Re: mysql apache - page never finish loading

            Mel wrote:
            On 2006-07-10 10:00:41 +1000, "flamer die.spam@hotmai l.com"
            <die.spam@hotma il.comsaid:
            >
            >i would stick in an ' or die (mysql_error ()); ' at the end of the
            >statement, probably is coming across an error but for some reason keeps
            >trying.. you really should have that on all your sql queries.
            >>
            >Flamer.
            >
            >
            >
            I'm curious: why should you always have one on SQL function calls? I
            never use them and opt for things like:
            >
            $link = @mssql_connect( CONNECTION_STUF F_HERE);
            if ($link === false) {
            // handle error
            }
            if (@mssql_select_ db(DBNAME,$link ) === false) {
            // handle error
            }
            $sql = "select * from myTable";
            $res = @mssql_query($r es);
            if ($res === false) {
            // handle error
            }
            >
            Normally this'd be in a class and '// handle error' would throw an
            Exception. This method is used heavily in my production environment and
            has yet to fail me. I'm not poo-pooing the idea of the die() or exit()
            functions inline with the SQL functions, just wondering why they should
            be used.
            >
            Mel,

            I'm with you. I don't use "or die..." either. I'd rather check the
            results, and if they aren't good, handle the problem.

            It's very unsettling to a user to have your pages break because of some
            minor database problem. It's even worse to have the error message
            displayed in their browser. Better to log the error and put up
            something like "I'm sorry but we're having problems right now" type of
            message.

            And for production machines I can even have it email me the error so I
            know something bad happened. Saves having to look through error logs.


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

            Comment

            • theGreatGnu@my-deja.com

              #7
              Re: mysql apache - page never finish loading

              Hi Flamer,

              The problem is not lack of error handling, and the snippet I submitted
              was just to illustrate the point. I am pretty sure that my problem
              isn't the PHP code itself. Rather it has something to do with the
              settings on the computer I am using at home. Firewalls, anitvirus, and
              such, as suggested earlier, seemed like a possible source of my
              problems, but unfortunately it didn't help to turn it all off.

              I was hoping that this was some kind of "known problem" when using PHP
              and mysql, but I guess I had no such luck.

              Anyway, thanks for your efforts!

              -Anders Bondensson

              flamer die.spam@hotmai l.com skrev:
              i would stick in an ' or die (mysql_error ()); ' at the end of the
              statement, probably is coming across an error but for some reason keeps
              trying.. you really should have that on all your sql queries.
              >
              Flamer.
              >
              theGreatGnu@my-deja.com wrote:
              >
              Alvaro G. Vicario skrev:
              *** theGreatGnu@my-deja.com escribió/wrote (8 Jul 2006 03:22:00 -0700):
              However, I'm stuck on an irritating problem. Whenever I connect to
              mysql, my PHP pages don't want to finish loading. In the following
              example, the page will not finish loading nor display "abc" until I
              interupt by pressing "Stop" in the web browser".

              <?php
              echo 'a';
              $link = mysql_connect(' localhost', 'user', 'pwd');
              echo 'b';
              mysql_close($li nk);
              echo 'c';
              ?>
              >
              Your code looks flawless to me. I'd say the problem could be in third-party
              software, such as:
              >
              - Antivirus
              - Firewall
              - Proxy
              ...
              >
              If you are using Windows, there's an Apache directive you can try (add it
              to httpd.conf file):
              >
              EnableSendfile Off
              EnableMMAP Off
              Win32DisableAcc eptEx
              >
              This seems to fix some Windows specific problems. If it works for you
              please let me know.
              Thank for your help. Unfortunately this did not fix the problem. I have
              added the above lines to the httpd.conf file, i have inactivated both
              firewall and anti virus, all in various combinations. Not sure what to
              do with the proxy server. Don't think I am using one, but I could be
              mistaken.

              Opera and IE behaves somewhat differently. With Opera, the "abc" will
              be displayed when I press "stop" in the browser. For IE, "abc" will
              never be displayed. The page will just not load.

              All this happens whenver I connect to mysql. Regular html or php pages
              will load happily.

              -Anders Bondensson

              Comment

              Working...