how php parses code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cord-Heinrich Pahlmann

    how php parses code

    Hi,

    I'm wondering when php executes the code.
    I have a little script which takes around 10 seconds execution time.
    In those 10 seconds the script does a lot of mysql_queries and changes
    some data.
    If the script stops after 5 seconds and restarts it will mess up my
    data.

    But it seems if php goes through the code and executes all the
    mysql-queries after it is finished (after the 10 seconds).

    So my question is, when does php executes the mysql-queries?

  • Curtis

    #2
    Re: how php parses code

    On Jan 25, 11:04 am, "Cord-Heinrich Pahlmann" <S...@Heineken2 000.de>
    wrote:
    Hi,
    >
    I'm wondering when php executes the code.
    I have a little script which takes around 10 seconds execution time.
    In those 10 seconds the script does a lot of mysql_queries and changes
    some data.
    If the script stops after 5 seconds and restarts it will mess up my
    data.
    >
    But it seems if php goes through the code and executes all the
    mysql-queries after it is finished (after the 10 seconds).
    >
    So my question is, when does php executes the mysql-queries?
    Once the client sends the request, the PHP is parsed by a running php
    process (i.e. cgi or apache module). PHP's database wrappers
    communicate with the database and handle the data.

    It sounds like there could be a problem with your configuration or
    code. This is probably the wrong avenue to explore to find a solution
    to your problem.

    --
    Curtis

    Comment

    • Rik

      #3
      Re: how php parses code

      On Fri, 26 Jan 2007 12:54:01 +0100, Curtis <dyer85@gmail.c omwrote:
      On Jan 25, 11:04 am, "Cord-Heinrich Pahlmann" <S...@Heineken2 000.de>
      wrote:
      >I have a little script which takes around 10 seconds execution time.
      >In those 10 seconds the script does a lot of mysql_queries and changes
      >some data.
      >If the script stops after 5 seconds and restarts it will mess up my
      >data.
      We've got a setting to ignore an abort:

      >But it seems if php goes through the code and executes all the
      >mysql-queries after it is finished (after the 10 seconds).
      >>
      >So my question is, when does php executes the mysql-queries?
      >
      Once the client sends the request, the PHP is parsed by a running php
      process (i.e. cgi or apache module). PHP's database wrappers
      communicate with the database and handle the data.
      >
      It sounds like there could be a problem with your configuration or
      code. This is probably the wrong avenue to explore to find a solution
      to your problem.
      Yup, unless you're using some weird code I'd say PHP executes queries on
      executing. mysql_unbuffere d_query can lead to some funky results sometimes
      though.
      --
      Rik Wasmus

      Comment

      • Cord-Heinrich Pahlmann

        #4
        Re: how php parses code



        On 26 Jan., 13:04, Rik <luiheidsgoe... @hotmail.comwro te:
        On Fri, 26 Jan 2007 12:54:01 +0100, Curtis <dye...@gmail.c omwrote:
        On Jan 25, 11:04 am, "Cord-Heinrich Pahlmann" <S...@Heineken2 000.de>
        wrote:
        I have a little script which takes around 10 seconds execution time.
        In those 10 seconds the script does a lot of mysql_queries and changes
        some data.
        If the script stops after 5 seconds and restarts it will mess up my
        data.We've got a setting to ignore an abort:http://www.php.net/ignore-user-abort
        >
        But it seems if php goes through the code and executes all the
        mysql-queries after it is finished (after the 10 seconds).
        >
        So my question is, when does php executes the mysql-queries?
        >
        Once the client sends the request, the PHP is parsed by a running php
        process (i.e. cgi or apache module). PHP's database wrappers
        communicate with the database and handle the data.
        >
        It sounds like there could be a problem with your configuration or
        code. This is probably the wrong avenue to explore to find a solution
        to your problem.Yup, unless you're using some weird code I'd say PHP executes queries on
        executing. mysql_unbuffere d_query can lead to some funky results sometimes
        though.
        --
        Rik Wasmus
        Thank both of you for the answers. I'm was actually pretty sure, that
        my code is OK. Those DB-Queries are pretty simple. I take some
        blowfish-encrypted passwords from my DB decrypt them, encrypt them
        with a newly generated key and then store them back into the DB.
        I just thought that the de-/encryption takes so long. When I do this
        with <10 passwords it is pretty fast. But when I do the same thing
        with 30 it takes at least 10 seconds.
        I will look through my code again and do some more testing. Maybe I
        have some weird loop hanging around somewhere.

        The ignore_user_abo rt function is really nice. I think I will have
        good use for it in this and future projects. Thx.

        Comment

        • Curtis

          #5
          Re: how php parses code

          On Jan 28, 2:41 pm, "Cord-Heinrich Pahlmann" <S...@Heineken2 000.de>
          wrote:
          On 26 Jan., 13:04, Rik <luiheidsgoe... @hotmail.comwro te:
          >
          On Fri, 26 Jan 2007 12:54:01 +0100, Curtis <dye...@gmail.c omwrote:
          On Jan 25, 11:04 am, "Cord-Heinrich Pahlmann" <S...@Heineken2 000.de>
          wrote:
          >I have a little script which takes around 10 seconds execution time.
          >In those 10 seconds the script does a lot of mysql_queries and changes
          >some data.
          >If the script stops after 5 seconds and restarts it will mess up my
          >data.We've got a setting to ignore an abort:http://www.php.net/ignore-user-abort
          >
          >But it seems if php goes through the code and executes all the
          >mysql-queries after it is finished (after the 10 seconds).
          >
          >So my question is, when does php executes the mysql-queries?
          >
          Once the client sends the request, the PHP is parsed by a running php
          process (i.e. cgi or apache module). PHP's database wrappers
          communicate with the database and handle the data.
          >
          It sounds like there could be a problem with your configuration or
          code. This is probably the wrong avenue to explore to find a solution
          to your problem.Yup, unless you're using some weird code I'd say PHP executes queries on
          executing. mysql_unbuffere d_query can lead to some funky results sometimes
          though.
          --
          Rik Wasmus
          >
          Thank both of you for the answers. I'm was actually pretty sure, that
          my code is OK. Those DB-Queries are pretty simple. I take some
          blowfish-encrypted passwords from my DB decrypt them, encrypt them
          with a newly generated key and then store them back into the DB.
          I just thought that the de-/encryption takes so long. When I do this
          with <10 passwords it is pretty fast. But when I do the same thing
          with 30 it takes at least 10 seconds.
          I will look through my code again and do some more testing. Maybe I
          have some weird loop hanging around somewhere.
          >
          The ignore_user_abo rt function is really nice. I think I will have
          good use for it in this and future projects. Thx.
          I'm glad we could narrow down the problem. I have the mcrypt lib
          enabled for my php installation, but I have yet to test it, but it
          seems like the encryption and decryption code is worth looking at. It
          couldn't hurt, posting your code here.

          --
          Curtis

          Comment

          • Cord-Heinrich Pahlmann

            #6
            Re: how php parses code

            Hi.

            I got the code from the following webpage: http://www.php-einfach.de/
            sonstiges_gener ator_blowfish.p hp#ausgabe
            It's German, though.
            I hope u can use it.

            Comment

            Working...