Google search quits on OS X.2 w/WebSTAR5.3

Discussion in 'Products & Tools' started by mduke, Mar 4, 2004.

  1. #1
    On OS X.2, WebSTAR 5.3 (server), DigitalPoint's Google search results page, which worked fine out of the box, suddenly quit (no results). My server logs show the same error results that I get on an alternative setup on (2) Unix/Apache searching the same site (the WebSTAR server). BTW, Unix php.ini had error reporting on so I could see the errors in browser.

    I doubt the numerous errors that appear at both sites are related to the OS X site no longer yielding results (AFAIK, these errors are not unusual and when I disable them on Unix, the search results work fine). I supply both URLs (search for something like "salmon" or "trout"), and the error code from my WebSTAR log, which is the same as the errors I got on Unix (this because I need to shut off error checking to at least temporarily have working search engine via remote site before I can resolve this on OS X):

    http://fish.washington.edu/search
    http://depts.washington.edu/safs/search

    I'm open to any suggestions. I suspect it's something to do with my OS X php.ini.

    Marcus Duke
    Webmaster/Info Specialist
    UW Aquatic & Fishery Sciences

    And here are the errs:

    PHP Notice: Undefined index: start in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 26
    PHP Notice: Undefined variable: line in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 34
    PHP Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php(38) : eval()'d code on line 2
    PHP Parse error: parse error, unexpected $ in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php(38) : eval()'d code on line 44
    PHP Notice: Use of undefined constant end - assumed 'end' in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 45
    PHP Notice: Undefined variable: urls in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 45
    PHP Notice: Use of undefined constant start - assumed 'start' in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 45
    PHP Notice: Undefined variable: urls in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 45
    PHP Notice: Use of undefined constant results - assumed 'results' in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 45
    PHP Notice: Use of undefined constant end - assumed 'end' in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 45
    PHP Notice: Undefined variable: urls in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 45
    PHP Notice: Use of undefined constant results - assumed 'results' in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 58
    PHP Notice: Use of undefined constant results - assumed 'results' in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 63
    PHP Notice: Use of undefined constant start - assumed 'start' in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 69
    PHP Notice: Undefined index: start in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 69
    PHP Notice: Use of undefined constant error - assumed 'error' in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 70
    PHP Notice: Undefined index: error in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 70
    PHP Notice: Use of undefined constant urls - assumed 'urls' in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 74
    PHP Warning: Invalid argument supplied for foreach() in /Applications/4DWebSTAR/WebServer/DefaultSite/search/results.php on line 74
     
    mduke, Mar 4, 2004 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    Checked the search.digitalpoint.com server to make sure it's giving proper results, and it does seem to be okay as far as the server goes.

    You can see if it's a connection problem between your server and search.digitalpoint.com, by editing your results.php file. Simply remove the "@" from the beginning of the fopen() statement. The "@" suppresses any errors it might have (they are suppressed by default so end users don't see your Google API key, since that's within the URL).

    If that shows no errors, add the following:

    echo $line;
    exit;
    PHP:
    after the following line:
    fclose($handle);
    PHP:
    That will echo to the browser what it's getting from search.digitalpoint.com instead of trying to evaluate it.

    Let me know what you find...

    - Shawn
     
    digitalpoint, Mar 4, 2004 IP
  3. mduke

    mduke Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, Shawn: I think I made some progress: (1) I got no errors from removing @, and (2) the "echo $line; exit;" string yielded plain text in the results part of the page (and also printed out the header (logo, title)). The search results for "salmon" are below. It seems to be working but just not formatting it (although why the original script said "no results," I dunno). I hope this yields some clues as to what needs to be fixed. I will try to leave the search pages as is for this morning, but soon I will have to redirect the search link to the Unix server, for now, if I can't fix this on the OS X server. Thanks for your help! Marcus

    BTW, in case, the URL is http://fish.washington.edu/search

    Search Results
    array ( \'urls\' => array ( 0 => \'http://www.fish.washington.edu/hatchery/salmon.html\', 1 => \'http://www.fish.washington.edu/sic/resources/\', 2 => \'http://www.fish.washington.edu/sic/\', 3 => \'http://www.fish.washington.edu/research/alaska/alaskapdf.html\', 4 => \'http://www.fish.washington.edu/research/alaska/images/facilities/aerial_chignik.html\', 5 => \'http://www.fish.washington.edu/research/alaska/pix_maps.html\', 6 => \'http://www.fish.washington.edu/research/alaska/images/scenic_wildlife/scenic_sockupstream.html\', 7 => \'http://www.fish.washington.edu/research/alaska/forecasts.html\', 8 => \'http://www.fish.washington.edu/research/highseas/\', 9 => \'http://steelhead.fish.washington.edu/~parker/gallery/salmon\', ), \'titles\' => array ( 0 => \'Salmon Life Cycle\', 1 => \'Salmon in the Classroom
     
    mduke, Mar 5, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    Okay, so it *is* getting results, so that's a good thing. :) For whatever reason your PHP setup seems to be adding backslashes to the results though. Without being able to test different configs on your server, it's hard to say... might be something to do with magic quotes within the php.ini or something.

    A work around that I can think of off the top of my head would be to edit the results.php file like so:

    Change:

    
    eval ('$urls = ' . $line . ';');
    
    PHP:
    to:

    
    eval ('$urls = ' . stripslashes($line) . ';');
    
    PHP:
    Let me know if that helps...

    - Shawn
     
    digitalpoint, Mar 5, 2004 IP
  5. mduke

    mduke Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Boyo, you done made my day, wot! That did the trick (I had to remove the echo $line; exit; code first, of course). The site's working fine now. Thank you so much! So you think it might be the magic quotes in the php.ini, eh? I'll look into this. I'm pretty sure I would'na done anything with those settings because I use them w/Dreamweaver MX 2004 (only been doing PHP sites for 1 years, still consider myself a beginner).

    If you have any suggestions on the ini, I'm all ears. Otherwise, I'll consider this case "closed." Thanks again.
     
    mduke, Mar 5, 2004 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #6
    Truthfully, I don't know... PHP has so many configuration options I often forget what does what (usually I leave everything as default).

    What you might want to do (since you have a machine it does work properly on) is run a simple PHP script that shows the PHP info for each server:


    
    <?php
    phpinfo();
    ?>
    
    PHP:
    That will show you what the server is currently configured for as well as what the default value of every option is. Might want to do a side-by-side comparison between the PHP setup that works and the one adding the slashes to help narrow down the difference between the two.

    - Shawn
     
    digitalpoint, Mar 5, 2004 IP
  7. mduke

    mduke Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Well, shoot: sure enough, the Univ php.ini has all magic_quotes properties turned off, and OS X has the the magic_quotes_gpc and ..._runtime on. I will experiment with changing the settings. This will be interesting in that it may be why I had to do a workaround for a Dreamweaver MX site page referral wherein I had to use $_POST['fieldname'] in the query string instead of $fieldname (again, this was another "works on Unix but not on OS X" issue). It would be great if the magic-quotes settings were the root of all my evils because the minute I hand-code DW PHP extensions, it makes it difficult to do any further editing using the extension GUIs.

    Well, this has been a most illuminating day. Good on ya, then!
     
    mduke, Mar 5, 2004 IP
  8. killer2021

    killer2021 Peon

    Messages:
    872
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Glad it could work out for you :)
     
    killer2021, Nov 11, 2008 IP
  9. edpatton

    edpatton Active Member

    Messages:
    261
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    83
    Digital Goods:
    1
    #9
    Nice one worked fine
     
    edpatton, May 29, 2010 IP