PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

PHP / CGI script returns no results on Apache RLimitMEM & RLimitCPU

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

  • PHP / CGI script returns no results on Apache RLimitMEM & RLimitCPU

    A note to Zoom users that use the PHP or CGI version of Zoom on servers that run Apache.

    Several users have reported a problem where they do a search and get no results. In some cases the search form is still displayed at the top of the page, in other cases you get a completely blank page.

    After investigation it seems that some shared hosting companies are severly limiting the amount of RAM and CPU available to PHP and CGI scripts.

    They can do this by setting the "RLimitMEM" & "RLimitCPU" directives in the Apache configuration for the server. Setting these values will cause Apache to kill any script after it uses more than a certain amount of RAM or CPU time.

    These values are normally set in the Apache httpd.conf file. (but can also appear in the srm.conf, access.conf and virtual host files)

    See,
    http://www.apacheref.com/ref/http_core/RLimitMEM.html
    http://www.apacheref.com/ref/http_core/RLimitCPU.html

    The timeout setting is also worth looking at.
    http://www.apacheref.com/ref/http_core/Timeout.html

    The solution is to get you hosting company to set reasonable limits for these values. Of course they might not like this becuase it means you are going to be using more of their CPU time and RAM.

    The larger your index files in Zoom, the higher these limits will need to be. Example limits for a medium sized site might be,
    RLimitMEM 32097152 32097152 #32 Meg of RAM
    RLimitCPU 20 60 #60 seconds of CPU time

    But before you start sending your hosting company nasty E-Mails check everthing else is correct.
    - Check the the indexing process was successful
    - Check that all files are on the server
    - Check that you can run other small PHP scripts.

    Note that if you have this problem, then there will be no error message of any sort, but you will see the search form. This is becuase the script was suddenly terminated. If you see an error message then these settings are probably not the cause of your problem.

    --------
    David
    Wrensoft

    Update: Oct 2005: If you are able to confirm with your hosting company that CPU run time is the problem and you are using PHP, then consider switching to the CGI option which will use less CPU time and give faster searching.

  • #2
    Still having this problem.

    Joe Everett
    tbaptist.com

    I have this very problem where there are no search results posted on the search form.

    The search engine is working fine one day, and then a few days later it isn’t.

    There is no apparent problem with the search files. They have been uploaded more than once, but no change. The search engine (with these search files) works fine on my home computer using a server application.

    I showed the RLimitMEM and RLimitCPU posting to my server webmaster, but he says that cannot be the problem, that the server values are much more than enough.

    He says they are using this configuration (which, admittedly, means little to me):

    Dul 2.8 w/4 GB ram

    Fedora Core 2

    php 4.3.8

    I am using Zoom Professional 3.1, I think (I don’t have it here for checking); I bought it last May.

    The server webmaster suggested that I enable error-logging --- how do I do this, and will it help since there are no errors reported?

    He also suggested that the search-engine may not work with php 4.3.8.

    Any suggestions?

    Regards, Joe Everett

    Comment


    • #3
      I just went to your web site and did a search,

      http://www.tbaptist.com/zoom/search.php?zoom_query=bible

      387 results were found and displayed correctly.

      So I assume that you have now fixed your problem becuase it seems to be working fine?

      --------
      David

      Comment


      • #4
        "So I assume that you have now fixed your problem becuase it seems to be working fine?"

        Well, so it is!

        It wasn't working this morning, but I guess my server company figured out the problem.

        Thanks for checking it out anyway; greatly appreciated.

        Regards, Joe Everett

        Comment


        • #5
          There are still a few people seeing this issue. So I wanted to post some additional details here.

          There are a number of cheap hosting companies that paid peanuts & employ monkeys to do support. These companies often deny there are any limits on their servers.

          This is a very simple script which should reach a count of 9,000,000. If it stops before this then the script's execution must have been terminated by something on the server. This would indicate that it is a problem independent of the Zoom search script.

          Code:
          <?php
          print("Begin test loop to allocate memory for 9,000,000 integers\n");
          for ($i = 0; $i < 9000000; $i++)
          {
              $dict[$i] = $i;    
              if ($i % 5000 == 0)
                  print ("allocated memory for " . $i . " integers. ");
          }
          print("End test loop\n");
          ?>
          This can help you prove to the monkey that there is a limit on their servers.

          EDIT: Previously this script counted to 2,000,000. But we edited this post a couple of years after it was written, and increased it to 9,000,000 to simulate heavier RAM and CPU usage.

          ----
          David
          Last edited by David; May-09-2009, 10:18 PM. Reason: Fixing line wraps which broke the example code & increase count from 2M to 9M

          Comment


          • #6
            Thanks, The script helped me

            Thanks so much for the software (at a great price)
            After running the script and only getting allocated memory for 130000 integers, (On our dedicated server) I was able to look at the limites tab and noticed it had changed from the default of 1024kb to 10240kb.. That did not work

            So as we have the search running on 2 different parts of our site, I loaded the settings fromt he working search, and just changed the web folder.. reran the index and now I do get how many results it found but nothing listed under that.

            I now need to look into changing the limits but have no clue how to access the httpd.conf file.

            I am just not sure why it doesn't work on one part of the site but it does on the other... (php shopping cart side works, html old site does not(but did)



            Thanks again for the professional and quick reply to my email,
            Jason Miller

            Comment


            • #7
              Update

              uninstalled/reinstalled and now it works again..

              Strange!

              Comment


              • #8
                I glad it is working again, becuase to be honest, I was a bit confused by the description of the problem.

                ------
                David

                Comment


                • #9
                  Where?!

                  Hi there

                  Where do I put that code mentioned above? at which file? or as a new file or what?

                  Thanks in advance

                  Comment


                  • #10
                    Yes. You make a file in Notepad called something like test.php, paste in the simple test script above, save it. Upload to your server and run the script.

                    It should print a bunch of lines like,

                    allocated memory for 5000 integers
                    ...
                    allocated memory for 2000000 integers
                    End test loop


                    If the last line, "End test loop", never prints out you have hit a server limit.

                    ----
                    David

                    Comment


                    • #11
                      another server?

                      Is there a way that I could host the search fiiles on another server that direct to my current server?

                      Thanks

                      Comment


                      • #12
                        Yes, you can upload the search files to any server that meets the requirements. The search results will still point back to the original documents on the original server.

                        -----
                        David

                        Comment


                        • #13
                          I ran the php test file and it stopped at 230000.

                          My hosting company is 1and1. They will not tell me what the RLimitMem and RLimitCPU is -- so far.

                          However, they maintain I can control this with .htacces.

                          Do you agree, and if so, what are the commands?

                          Comment


                          • #14
                            I believe it is possible to modify RLimitMEM and RLimitCPU via .htaccess if the Apache server is configured to allow this. However, this is a highly unlikely setting unless you are on a dedicated server. This would otherwise mean that any account on your shared server may be requesting to use 100&#37; CPU or all available RAM, and the server is unlikely to handle this. If they maintain that you can control this, they should be able to tell you how to do so. The syntax should otherwise be the same as the setting in the php configuration file.

                            Alternatively, they might be thinking of the memory limitation for PHP which is more commonly available for user control in .htaccess as described in this FAQ. This limit is applied prior to the Apache limit, which means that even if you have this limit allowing for 32MB of memory, if there is an Apache RLimitMEM set to 4MB, you will still be restricted to 4MB. It would be worth checking however, if it is the PHP limit that you are running into or the Apache one. The PHP limit should normally report an error message (eg. ""Fatal error: Allowed memory size of 8388608 bytes exhausted..." or similar) either on the page itself or in the server logs.
                            --Ray
                            Wrensoft Web Software
                            Sydney, Australia
                            Zoom Search Engine

                            Comment


                            • #15
                              error message

                              I have tested script test.php , but obtain this error message:

                              Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /var/www/web236/html/test.php on line 7

                              Parse error: parse error, unexpected T_PRINT in /var/www/web236/html/test.php on line 8

                              thank you

                              Comment

                              Working...
                              X