PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

PHP Platform execution timeout

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

  • PHP Platform execution timeout

    Hi,

    We've just purchased Zoom Search professional, downloaded the latest version (v 6.0.1006) and found out that the search page (PHP) doesn't work.
    Script stops after 30 seconds due to a PHP timeout and only displays the part of search template above the '<!--ZOOMSEARCH-->' line (line 90 by default).

    What we found out is that the script hangs up on parsing line 89 of the template file (search_template.html) and never finishes. This is the reason behind the timeout.

    We did not change any code (not PHP nor template), this is a default output from Zoom Search we're having problems with.

    There is a similar issue on the forum pointing to memory limit errors, which is not the case here.
    However, in the same thread, there is a mention of old script being used on a website which had parsing problems and generated this error, too.
    The thread says that this should be fixed in build 1002, however in 1006 it still appears to be a problem. Is this the same parsing error we are having?

  • #2
    There is no known issues that would cause the script to hang then timeout.
    What was the exact error message?
    What is the URL for your search function so we can see the problem?
    What version of PHP are you running on this server?

    Comment


    • #3
      Error message is the generic one from PHP:
      Fatal error: Maximum execution time of 30 seconds exceeded in .....\search\search.php on line 283

      The file search.php is the original file generated by Zoom Search.
      What is a bit confusing in this case is the line number - on line 283 in that file, there is just this:
      global $OUTPUT_FORM_MATCH, $OUTPUT_FORM_CATEGORIES, $OUTPUT_FORM_CUSTOMMETA;

      However, when we tried to debug search.php file, we found out that the while loop, starting on line 349 in ShowTemplate() function will hang and never increment $template_line beyond 89.
      Line 89 in search_template.html is " </p>"
      Line 90 in search_template.html is " <!--ZOOMSEARCH-->"


      This is a website in development, so there's no live URL to show you.
      Everything is being stored locally at the moment.

      PHP version: 5.2.6


      Edit: we're using CodeIgniter to build the website, if that info helps at all
      Last edited by PixelScene; Jan-20-2009, 10:32 AM.

      Comment


      • #4
        I think you must had modified either the template or the script even if only accidentally. But there should be nothing you can put in the template file that could cause this. Can you zip up all your Zoom files and E-Mail them to us and we can try and reproduce the problem here.

        Also, line 283, is in the function ShowDefaultForm, which is called by the function ShowDefaultSearchPage which is called from within the while loop you are refering to. So the line number does make some sense.

        Comment


        • #5
          Files zipped and sent.

          Edit: line 283 is indeed in the ShowDefaultForm() function, but that line just defines global variables, so that's my confusion - it should never be able to generate any error
          Last edited by PixelScene; Jan-20-2009, 02:55 PM.

          Comment


          • #6
            The problem is now resolved.
            Your PHP script has a lot of variables defined in settings.php and search.php files, which are used in multiple functions.
            These variables, however, are not being globalized, so they can't be used when search.php is included from within a function.

            Example:

            PHP Code:
            $abc 1;

            function 
            aaa() {
               global 
            $abc;
               echo 
            $abc;
            }

            aaa(); // would print 1 

            … BUT …


            PHP Code:
            function inc() {
               require(
            'search.php');
               
            abc(); // would not print anything, because $abc is only set in search.php
                      // and not being globalized in this inc() function



            Putting a lot of global's for each variable solves this, although this approach is not usable with CodeIgniter's architecture, so we'll have to use it standalone.
            Thanks for your quick replies and your help.

            Comment


            • #7
              Just to clarify for our other readers:

              The problem discussed in this thread has to do with the use of the Zoom PHP search script (search.php) within another PHP script/wrapper that the original poster wrote for use within a third-party "CodeIgniter" framework.

              This is not default, nor designed or supported usage, so it would not typically be necessary for the average user.

              Just wanted to clear that up should some of our other users read this thread and get confused since it was not spelled out in the original description of the problem.
              --Ray
              Wrensoft Web Software
              Sydney, Australia
              Zoom Search Engine

              Comment


              • #8
                The Fix

                I found this thread searching for an answer to this so I figure I'd post the fix I came up with. It would have been better to recreate the whole thing as a class, but I was pressed for time. Basically I removed the "global" declarations and passed them through function to function, eliminating the scope problem.

                Note:
                -I am sorting by relevance, not by date so I did not update that function.

                -This was taken from the 6.0 version.

                -This is provided AS-IS with no warranty whatsoever.

                -You must update the $ZOOM_ROOT_DIR variable to point to the correct location.

                I didn't see a file upload option, so here's a link:
                http://eekrano.com/wrensoft/search.phps

                Comment

                Working...
                X