Announcement

Collapse
No announcement yet.

a question for php users

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • a question for php users

    I've got a script that takes a lot of time to run (nearly 30seconds on a P3-800). I'd like to know if there's a way to stop php displaying an error if it reach the 30 seconds timeout.
    P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f

  • #2
    Are you referring to a windows message saying the program isn't responding or one from php???
    Chief Lemon Buyer no more Linux sucks but not as much
    Weather nut and sad git.

    My Weather Page

    Comment


    • #3
      Not exactly... my script runs for a certain amount of time and then a message gets displayed at the bottom of that page which say's : "Fatal error: Maximum execution time of 30 seconds exceeded in /www/htdocs/GetCat.php3 on line 300"

      I just don't want that message to be displayed... i did try to use the set_time_limit on the top of the page... which corrected the problem for one user... but now i'm thinking what would happend if more that one user use that script...?
      P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f

      Comment


      • #4
        It should work fine for any number of users, since each user starts a different instance of the script, and the time is kept separately for each one.

        Comment


        • #5
          Okay... but i'm more thinking if i set that to 60 sec for that page only. And have let's say 10 000 users connected... won't the cpu lack time to process it since it has some difficulties with 2-3 users connected?

          Oh and a last thing... is the max time on a page include the time the user download the page? 'cuz i'm testing on 10mbits lines and OC3... it might be a big problem for users that are on 56k since the page get's really huge.
          P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f

          Comment


          • #6
            According to the php documentation, the timer only counts the time the script is actually running. Ie. it doesn't count time spent waiting for database queries, execution of external programs, reading a file, or sending the page to the user.

            If the page is taking that long to generate you should probably look at some ways to speed it up, not many people will want to wait 30 secs for a page to be created and then have to wait for it to get to their computer. If performing database access, try and put any qualification on the data in the database queries, since it will probably be faster at that than the php script (especially if using indexing on the database). Other stragies include limiting the amount of data shown on each page, and caching some of the information if possible.

            Comment


            • #7
              Okay... well... it's a problem then 'cuz i dont have a database on which i could place indexes. I guess i'll have to go with your last suggestion... limiting the displayed data. I still have no idea about how i will do that but i'll have to find a way.
              P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f

              Comment


              • #8
                What exactly are you doing? I might have some ideas to make it work better.

                Comment


                • #9
                  Well I can't give any specific suggestions, but you could try profiling the scripts involved to find where the performance bottlenecks are and try to optimize these parts of the scripts.

                  Here are some links for profiling PHP scripts:

                  An O'Reilly.net article on profiling PHP scripts

                  DBG PHP debugging extesion (supposedly also allows profiling)

                  Avanced PHP Debugger - Also says is allows profiling

                  It seems that DBG allows plugging in to some IDEs and using the profling features of the IDE.

                  Comment


                  • #10
                    Thanks, i'll see if there's something to be optimise with these when the script will be completed... in about a week.
                    P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f

                    Comment


                    • #11
                      I assume you have permission from google to do this. Normally they don't appreciate metasearchers and such using google.

                      Comment


                      • #12
                        we do... i don't remember how much it cost but it's expensive.
                        P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f

                        Comment


                        • #13
                          Check your php.ini file, there is a 'safe' option in there that shuts the script down if it runs longer then 30 seconds, you can turn that off. However check to optimize the code first

                          Dan
                          Juu nin to iro


                          English doesn't borrow from other languages. It follows them down dark alleys, knocks them over, and goes through their pockets for loose grammar.

                          Comment


                          • #14
                            thanks for the hint... i'll test that on my linux machine in 5 mins to see if it works well... but i doubt i'll be able to change that on the server i don't have that kind of privileges.

                            And on an other side... i would'nt want to break the config of the 4 brand new sun server... i'm relatively new to linux so i'll kinda stay away of these modifications.
                            Last edited by spazm_1999; 11 May 2002, 20:55.
                            P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f

                            Comment

                            Working...
                            X