We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20014
    • 200 Posts
    once again ladies and gentlemen,

    I have used ajax search on a remote site

    here is the call:
     [!AjaxSearch? &ajaxSearch=`0` &AS_landing=`92` &tplLayout=`ajaxlayout` &AS_showResults=`0` &tvPhx=`0` &showMoreResults=`0`!]


    and here is the template:
    [+as.showForm:is=`1`:then=`
     <form [+as.formId+] action="[+as.formAction+]" method="post">
        <input type="hidden" name="advSearch" value="[+as.advSearch+]" />
        <label for="ajaxSearch_input">
          <input id="ajaxSearch_input" class="cleardefault" type="text" name="search" value="[+as.inputValue+]"[+as.inputOptions+] />
        </label>
        <label for="ajaxSearch_submit">
          <input id="ajaxSearch_submit" type="image" src="assets/templates/Theme/images/search.jpg" value="search"/>
        </label>
    </form>
    `+]
    [+as.showIntro:is=`1`:then=`<p class="ajaxSearch_intro" id="ajaxSearch_intro">[+as.introMessage+]</p>`+]
    [+as.showResults:is=`1`:then=`[+as.results+]`+]


    the landing page:
    [!AjaxSearch? &AS_showForm=`0` &ajaxSearch=`0` &tvPhx=`0`!]


    now what I get when the results are more than five is:
    [+as.showResults:is=`1`:then=` [+as.noResults:is=`1`:then=`
    `:else=` 
    This appears between the search results and the heading.
    I’ve looked at the markup, but the [*content*] is within it’s own div, so I don’t think the heading’s style is effecting it.

    I haven’t gotten to styling the landing page at all and as you can see, I made a simple call and added &tvPHX parameter...
    I have already read two posts concerning this error here http://modxcms.com/forums/index.php?topic=42074.0
    and here http://modxcms.com/forums/index.php?PHPSESSID=d4ab00ef6b49ccefa8c46f5f9d8ed29f&/topic,42498.msg254593.html#msg254593
    but I haven’t been able to resolve it, the latter link seems to be the issue I want to resolve, but I am not quite understanding it...

    p.s. I am on the generally available not the beta version of modx, and ajaxsearch is 1.8.4
      • 5811
      • 1,717 Posts
      I haven’t been able to resolve it, the latter link seems to be the issue I want to resolve, but I am not quite understanding it...

      To resolve it you need to edit your my php_init file and double the value of the pcre.bactrack_limit. For instance from 100000 to 200000
      ;PCRE library backtracking limit.
      pcre.backtrack_limit=200000
        • 20014
        • 200 Posts
        can I do this with .htaccess? I don’t have a php.init file in my installation.
          • 20014
          • 200 Posts
          tried to modify the htaccess but it caused a server error, how do I edit the php.ini file if there isn’t one for the installation on the remote server? I only have the htaccess file in my root, and don’t see any other config type file in the subfolders.
            • 3749
            • 24,544 Posts
            php.ini is just a text file so you should be able to create it with just that line and upload it to the MODx root directory (assuming that the server is set up to allow and process it).
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 20014
              • 200 Posts
              didn’t work, I uploaded to root ran php info, and it didn’t take,

              the host requires all changes via .htaccess, but after searching how to modify the PCRE rule via .htaccess, I have come up empty handed,
              this is from the host:

              Example for php.ini/.htaccess file:

              Linux Shared Hosting and Managed Servers running PHP as a CGI:

              Filename: php.ini

              upload_max_filesize = 10M
              post_max_size = 10M

              Managed Server running PHP as an Apache Module:

              Filename: .htaccess

              php_value post_max_size "10M"
              php_value upload_max_filesize "10M"

              NOTE:
              You will not use a full php.ini file to make changes to PHP directives. The file should only contain
              the directives to be changed, as in the example above. You will need a php.ini file in every directory
              for which you want the changes to apply. Not all directives are changeable/installed. If you have
              made a change in php.ini and it is not working correctly, please contact Technical Support for more information.

              if I had it on linux shared then I would have to create a php file each and every directory(god, don’t think I’d be very sane afterwords)? so since I am on a managed server with php as a module, I would assume I would have to just modify the .htaccess, but how could I do that without causing a server error which had happened with my previous attempt? just add php_value to the lines?

              EDIT: adding php_value didn’t work either, internal error reported.
              here’s my .htaccess, pretty much the default:
              # For full documentation and other suggested options, please see
              # http://svn.modxcms.com/docs/display/MODx096/Friendly+URL+Solutions
              # including for unexpected logouts in multi-server/cloud environments
              # and especially for the first three commented out rules
              AddType x-mapp-php5 .php 
              #php_flag register_globals Off
              #AddDefaultCharset utf-8
              #php_value date.timezone Europe/Moscow
              
              Options +FollowSymlinks
              RewriteEngine On
              RewriteBase /
              
              # Fix Apache internal dummy connections from breaking [(site_url)] cache
              RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
              RewriteRule .* - [F,L]
              
              # Rewrite domain.com -> www.domain.com -- used with SEO Strict URLs plugin
              #RewriteCond %{HTTP_HOST} .
              #RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
              #RewriteRule (.*) http://www.example.com/$1 [R=301,L]
              
              # Exclude /assets and /manager directories from rewrite rules
              RewriteRule ^(manager|assets) - [L]
              
              # For Friendly URLs
              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_FILENAME} !-d
              RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
              
              # Reduce server overhead by enabling output compression if supported.
              #php_flag zlib.output_compression On
              #php_value zlib.output_compression_level 5
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                No, you only need php.ini files in every directory where a php script is run. In most cases, that’s the root (everything is run through the index.php file) and /manager (again, everything there is run through its index.php file). Now in the case of external AJAX processors, then you would need one in its directory; but if you use MODx documents with snippet as your AJAX processor, then the one in the root will cover it.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 20014
                  • 200 Posts
                  >:( huhI have been in contact with the host and their answer is to google it...amazed they didn’t say "RTFM" can you believe that?
                  I have tried everything
                  in .htacess modifying as such:

                  • php_value memory_limit 24M

                  • setting .ini files inside various directories or just in the root,

                  • adding this to the php.index file:
                    ini_set("memory_limit","32M");

                  • scouring sites such as askapache

                  and nothing and it seems though I have stated that the answer is the backtrack limit, the host isn’t willing to help
                  , where their own documentation says to contact them specifically (host is one and one if anyone cares)!

                  I have tried around fifty or so different ways to see if I could resolve this, but I am at my wit’s end, I mean I guess I could
                  understand if the error was arising from 20 or so returns on the search but five is the limit?
                  if I figure this out, I will post the answer so others can find it.
                  thanks all for your help
                    • 20014
                    • 200 Posts
                    The host got back to me and said the backtrack can’t be modified, soooooo
                    does anyone have a possible workaround? spent some time on styling the form, and now it doesn’t seem like something good to have
                    if it returns a bunch of error code on search landing pages, maybe have to go with the ol static site google search, which I rather not do either
                    so if anyone has an idea on how to perhaps "hide" the text I would be most thankful...
                    I am seriously, to put it in layman’s terms, bummed out.

                      • 3749
                      • 24,544 Posts
                      Have you tried putting this in the index.php file (or near the top of the plugin code):

                      ini_set('pcre.backtrack_limit', '16000000');
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting