View Full Version : Fix for search.cgi errors

09-03-2003, 09:17 PM
Well I finally got my old search.cgi scripts working. Here's what you will need to do if you are having the same problem.

This is assuming you have the two files search.cgi and search_define.pl.

You will also need the file cgi-lib.pl. (you can get it at http://cgi-lib.berkeley.edu/) This file was in my cgi-bin folder already.

Get the file and create a folder in your cgi-bin called "library". Put the cgi-lib.pl file in this folder.

cgi-lib.pl changes

Change line 1 to: #!/bin/perl

search.cgi changes

The file search.cgi points to cgi-lib.pl at lines 26 and 27 by saying: $lib = "/library"; # Default path for loading libraries
require "$lib/cgi-lib.pl"; Remove the leading forward slash in the "/library" statement to make it read "library".

Change line 1 of search.cgi to #!/bin/perl.

search_define.pl changes

Change lines 15 and 16 to read:
$root_web_path = "/www/htdocs/";
$server_url = "http://yourdomain.com";
Line 24 defines files and folders you want to exclude from your searches. Make sure you exclude things like your cgi-bin and other private folders. I notice my /plugins folder showed up in a search on my site so I had to add it to the list. There will probably be some others I'll have to add.

Once these changes are made the the search.cgi should work. At least it does on my site.

Some of you more tech savvy webmasters out there probably can explain this a little better and it may be that I've done something I shouldn't have. If this is the case please let me know.

Some have been reporting that perl hasn't been installed in the transition to 2.0 so make sure it's installed too.

One other thing, if you have to get the cgi-lib.pl file set it's permissions to 755. That's what mine is set to.

Hope this helps! Now off to get my Guestbooks working!


09-06-2003, 05:02 PM
Thank you very much!!! You solved it!

09-06-2003, 05:30 PM
Hi JS Doyle,

thanks for your post. I had a formmail problem since the move but figured out the problem--when I changed the path as the manual said to do for cgis I had removed the #! in front of the path so it would look just like what the manual said. I put them back in and now the forms are working again.

09-08-2003, 08:49 PM
Hi JSdoyle

I'm back for more. Thanks for your very clear instructions on the search.cgi as I couldn't get mine to work but they are now.

09-08-2003, 08:54 PM
You're welcome Lori. I had similar problems with my guestbook. If you need help with it let me know.


09-09-2003, 10:34 AM
Oh darn!! I forgot about my guestbook. Yes, I'll need that fix also please.

09-10-2003, 12:15 PM
JS Doyle, I finally tried your search solution (been dealing with email) but I'm still getting an internal server error. I think I did everything you said. Any ideas what I may be doing wrong? Thanks.

09-10-2003, 01:19 PM
I'm at work and have a bunch of bullets to ID to a gun right now but I'll try to answer later after I get off work.


09-11-2003, 09:45 AM
I got the search to work on one site; now I'm off to try the other. Don't know what I was doing wrong yesterday, but it's okay now. Thanks a bunch.


09-27-2003, 04:57 PM
I thought I had the search script going fine until today. I did a search on my site and came up with dozens (hundreds?) of duplicate returns and I don't know where they come from. For example, one search brought up the following:

Herb Meanings and Herbal Information, A-B (/herbal-AB.html)
Herb Meanings and Herbal Information, A-B (/html/herbal-AB.html)
Herb Meanings and Herbal Information, A-B (/html/html/herbal-AB.html)
Herb Meanings and Herbal Information, A-B (/html/html/html/herbal-AB.html)

And so on, apparently in an endless loop - I didn't wait for the page to finish loading. What did I do?

09-27-2003, 07:36 PM
jsdoyle, what do you do for a living? Do you work in forensics? Just curious.

09-27-2003, 09:15 PM
Yeah, my website is www.firearmsid.com. I'm in the middle of a redesign of my site right now. Actually just getting started.