Live Site XML Search - php install getting error

Jeanne Morgan's Avatar

Jeanne Morgan

28 Apr, 2010 04:09 PM

Hi,

I am trying to set up the Live Site XML Search here: http://www.hannonhill.com/kb/cast/search/

I'm pretty sure I have it set up according to instructions, but when I input a search time I get the php error:
Warning: Invalid argument supplied for foreach() in /var/www/udmercy.edu/giving/scholarshipbook/search/search.php on line 164

Is this something in my set up?

Thanks,

Jeanne

  1. Support Staff 1 Posted by Tim on 28 Apr, 2010 06:26 PM

    Tim's Avatar

    Hi Jeanne,

    I took a quick look at that file (and that specific line on which the error is occurring) and it appears to be failing here if I'm not mistaken: foreach ($databases as $fname)

    This error could mean that the $databases variable is null or structured incorrectly. Perhaps you can perform a check just before that line to see if this variable contains anything. Maybe try something like: echo "databases variable: $databases ...<br/>";

  2. 2 Posted by Jeanne Morgan on 28 Apr, 2010 06:41 PM

    Jeanne Morgan's Avatar

    Hi, Tim,

    Thanks for the reply. I see there is no $databases. I do not see in the configuration a place for naming $databases, or setting that up. Any thoughts?

    Jeanne

  3. Support Staff 3 Posted by Tim on 28 Apr, 2010 07:05 PM

    Tim's Avatar

    Can you attach the search-config.xml file that you have configured for your instance?

  4. 4 Posted by Jeanne Morgan on 28 Apr, 2010 07:26 PM

    Jeanne Morgan's Avatar

    Here is the file

  5. Support Staff 5 Posted by Tim on 28 Apr, 2010 07:42 PM

    Tim's Avatar

    Can you check to see if the file search-index-page.xml has been published to your web server and that it lives in the same directory as search.php?

  6. 6 Posted by Jeanne Morgan on 28 Apr, 2010 07:45 PM

    Jeanne Morgan's Avatar

    It has.

  7. 7 Posted by Jeanne Morgan on 28 Apr, 2010 07:50 PM

    Jeanne Morgan's Avatar

    I'm seeing in the search-config file that the frame file (linked to from the Data Definition that was setup) is not giving the correct extension.

    <frame_file>
    ../../../www.udmercy.edu/giving/scholarshipbook/search/index.aspx </frame_file>

    Shouldn't it be a php? How is it adding that extension, and could that be the problem?

  8. Support Staff 8 Posted by Tim on 29 Apr, 2010 03:44 PM

    Tim's Avatar

    I don't believe that would be causing this problem. Since you mentioned that the $databases variable is null, my guess is that the search.php file may be having trouble reading the search-config.xml file on your web server.

    Can you verify that your search.php file contains the following around line 14?

    $config_file = "search-config.xml";
    

    We definitely need to make sure it's pointing to the correct location. Obviously, if it is configured as mentioned above, it will need to be located in the same directory (and you mentioned it is).

    It looks like the search.php file will try to get the value contained in the element

    <files><file>search-index-page.xml</file></files>
    

    For some reason, this appears to be failing.

    I haven't had a chance to set this up locally yet, but once I have some time I will try to do so to see if I run into similar problems.

  9. 9 Posted by Jeanne Morgan on 29 Apr, 2010 08:21 PM

    Jeanne Morgan's Avatar

    Hi, Tim,

    I'm out of the office until next wednesday so while I am checking my email, my replies are slow. Sorry about that.

    Yes. That line is the search.php

    In the config xml:


    search-index-page.xml
    <cms_file>
    /www.udmercy.edu/giving/scholarshipbook/search/search-index-page </cms_file>

    So that looks on target.

    Thanks!

  10. Support Staff 10 Posted by Tim on 30 Apr, 2010 03:59 PM

    Tim's Avatar

    Jeanne,

    I had a chance to set this up earlier today and I ran into this same problem. However, my issue was caused by my search-config.xml file not being constructed as the sample configuration file is on our KB site. The reason for that is due to numerous changes that have been made to the software since this article was posted. Once I manually changed my configuration XML to match the sample (which yours already does), I did not receive the error. Your configuration file appears to be correct so I believe the error is being caused by something with the location of these files in relation to one another.

    I will say that the CAST items in that section of our site are very old and most of them are outdated (they were created during the 4.x series). For example, this particular PHP search XML script includes information for configuring Targets (which do not exist in the context of Sites if you are using Sites in 6.x). The CAST items are meant as examples so hopefully you will be able to make a few minor tweaks to get things up and running as you need them.

  11. Tim closed this discussion on 07 May, 2010 02:59 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac