Forum Moderators: coopster & phranque

Message Too Old, No Replies

need help with 3rd party perl script--search not working

total perl newbie trying to make client happy-pls help

         

Sari

12:15 pm on May 1, 2005 (gmt 0)

10+ Year Member



I took on a design client and the deal was that I was to redesign the look of the template that their 3rd party classifieds software uses for their site. I did the redesign and tested it and everything worked fine, until a couple of days ago--that's when the search feature stopped working! :( Of course they call me to fix it, and I don't know Perl at all! (I told them this before taking the design job and said so in the contract--but I want to "make them happy" if I can).

Their site is set up with each section having it's own .db file (i.e. section1.db, section2.db etc.). I've managed to get the search for the each of the individual sections to work by using the following link to the search page:


<a href="/cgi-bin/classifieds/classifieds.cgi? db=section1&website=default&language=&session_key=&view_database_button=on"> Search Ads</a>

The problem is that the general search for all of the sections at once no longer works. What gets me is that it was working fine on Wednesday (the problem was reported to me on Friday). Here's the link I was using:

<a href="/cgi-bin/classifieds/classifieds.cgi? website=&language=&session_key=">Search Ads</a>

This would no longer refer to the search page so i changed the link to:

<a href="/cgi-bin/classifieds/classifieds.cgi? website=&language=&session_key=&view_database_button=on">Search Ads</a>

This now takes the user to the search page, but when they try to perform the search they get the following error:

Content-type: text/html
We're sorry, but the script may be down for maintenance. Please try again in a few minutes.

For debugging: Specifically, the script was not able to access in the Read Database routine of /home/usr/public_html/cgi-bin/classifieds/library/search.pl at line number 51. Please make sure the path is correctly defined in the db file and that the permissions are correct.

Thinking this was a problem with the search.pl file, I uploaded the file again from a backup, and it still doesn't work. :( I am assuming that it is not a permissions issue as the individual section searches now work.

My guess is that I need to specify which .db files to search, then it will work (please correct me if I'm wrong). How do I specify in the link for it to search all of the .db files at once?

Thanks in advance for the help!

BTW--Any ideas on why this would be working one day and not working the next? Thnx!

[edited by: jatar_k at 9:04 pm (utc) on May 2, 2005]
[edit reason] fixed sidescroll [/edit]

Sari

1:29 pm on May 2, 2005 (gmt 0)

10+ Year Member



Can anybody help me with this?

abbeyvet

1:46 pm on May 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe the link is wrong, try changing:

<a href="/cgi-bin/classifieds/classifieds.cgi?website=&language=&session_key=&view_database_button=on">

to

<a href="/cgi-bin/classifieds/classifieds.cgi?website=default&language=&session_key=&view_database_button=on">

The problem isn't with search.pl, it is in another file that search.pl needs. A wrong path in a db file? A wrong path in a config file somewhere?

Since this is all to do with a third party script you would probably be best looking for support from whoever wrote it - do they have a forum?

Sari

2:12 pm on May 2, 2005 (gmt 0)

10+ Year Member



Thanks for the try Abbeyvet. I changed the link as you suggested, but it didn't work.

Unfortunately, my clients purchased this software long before I was hired and they selected a vendor that has no forum and very few knowledgebase articles. This vendor charges $150 US per hour (my client is in Canada so that's around $175-180/hour) for tech support.

You can see why I'm trying to do what I can for them!

What I don't understand is why it was working, then within a couple of days after I was last on the site, this one feature stopped working (I didn't modify any files that day).

I have uploaded the main cgi files from the backup copy I had, including any .pl files that had anything to do with search, and it still does not work.

Any other ideas?

Thanks again!

The Contractor

2:40 pm on May 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you try full path <a href="http://www.yourdomain.com/cgi-bin/classifieds/ classifieds.cgi?website=default&language=&session_key=&view_database_button=on">

Are you sure you need that long string at all? Most search scripts are run via a form action like below (taken from another classified script):

<FORM METHOD="post" ACTION="http://www.yourdomain.com/cgi-bin/classifieds/classifieds.cgi">
<INPUT TYPE="hidden" NAME="session_key" VALUE="">
Search for
<input name=keywords type=text size=12 value="">
<INPUT TYPE="hidden" NAME="case_sensitive" value="">
<INPUT TYPE="hidden" NAME="results_format" VALUE="headlines">
<INPUT TYPE="hidden" NAME="query" value="keyword_plus">
<INPUT TYPE="hidden" NAME="search_and_display_db_button" VALUE="Search!">
using
<select name="boolean" size=1>
<OPTION value="any terms">any of my keywords
<OPTION value="all terms">all of my keywords
<OPTION value="as a phrase">this exact phrase
</select>
<INPUT TYPE="submit" VALUE="Search!">

Sari

3:13 pm on May 2, 2005 (gmt 0)

10+ Year Member



Hi The Contractor, yep I tried an absolute path already and it didn't work.

The code for the form looks right to me, but maybe I'm missing something? Here it is:


<FORM METHOD =" post" ACTION =" [domain.com...]

<INPUT TYPE =" hidden" NAME =" db"
VALUE =" ">
<INPUT TYPE =" hidden" NAME =" website"
VALUE =" default">
<INPUT TYPE =" hidden" NAME =" language"
VALUE =" ">
<INPUT TYPE =" hidden" NAME =" session_key"
VALUE =" ">
<center>
<table border=0 cellpadding=4 cellspacing=4 bgcolor="#ffffff">
<tr><td colspan=2>Advanced Search</td></tr>
<tr>
<th align=left>Find Keywords:</th>
<td><input name=keywords type=text size=30></td>
</tr>
.
.
.
<tr>
<th align=left>Ads Must Match</th>
<td><SELECT NAME="boolean">
<OPTION value="any terms">any of my keywords
<OPTION value="all terms">all of my keywords
<OPTION value="as a phrase">this exact phrase
</SELECT></td>
</tr>
<tr>

<tr>
<td colspan=2>
<INPUT TYPE="hidden" NAME="query" value="advanced_search">
<INPUT TYPE =" hidden" NAME =" search_and_display_db_button"
VALUE =" Search for Matching Ads">
<INPUT TYPE =" submit" VALUE =" Search for Matching Ads"></center>

It seems to me that the action is right, but I need to get the "backend" to put the value to search all the databases in the

<INPUT TYPE =" hidden" NAME =" db" VALUE =" "> 
field.

I was able to do this for the individual sections by putting db=sectionx in the referring url. Is there a similar "trick" to get it to insert all of the databases in the hidden field value? (it may not be elegant, but if it works I'll be happy!)

Thanks again!

rocknbil

3:34 pm on May 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What I don't understand is why it was working, then within a couple of days after I was last on the site, this one feature stopped working (I didn't modify any files that day).

I read all, then skimmed again, and don't see anywhere that you've checked execute permissions. If the require/include is indeed in the correct place, **something** may have changed or reset the permissions on that file.

OR

It could be that the server config was reset and your include needs to be named .cgi instead of .pl. How can this happen? I've worked with an auto-hosting setup that would regularly override our server config files. That is, we config'ed .pl and .cgi to execute, but something kept setting it back to .cgi only, munging up my includes.

The Contractor

3:48 pm on May 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sari without knowledge of the script in question I have no idea of what is required etc... You could sticky me the url, program name, etc., but not sure when I would have time to check it out. If it's a popular program that many are using try doing a search in google for allinurl:classifieds/classifieds.cgi and see if you can view the source of others that are using it.... might help? Also beware of extra spaces etc in your forms values/hidden values as that can also screw things up.

Sari

7:00 pm on May 2, 2005 (gmt 0)

10+ Year Member



Rocknbil:

Thanks for the permissions tip. I finally found a document which told what permissions each file required and have changed everything. It didn't fix this particular problem, but it did solve another issue that I've been having with the site. :)


It could be that the server config was reset and your include needs to be named .cgi instead of .pl. How can this happen? I've worked with an auto-hosting setup that would regularly override our server config files. That is, we config'ed .pl and .cgi to execute, but something kept setting it back to .cgi only, munging up my includes.

If this were the case, wouldn't all of the perl components of the site not work? What's the best way to check to see if this is what's happened?

The Contractor:
Thanks for your offer! I will do the google search as you suggest after lunch, and hopefully that will give me some clues. If I still can't get it going after that, I'll send you the info.

Thanks again!

rocknbil

3:46 pm on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, in my example, the default config for this particular domain was to execute only .cgi extensions. I used a .pl file as an include. We added .pl to the server config and a week or so later it would 500. When we looked into it, our .pl config was gone. The admin said he fixed it, but to be safe I just renamed the .pl to .cgi and changed the include line in my main script.

The way to find out, if you can't locate and review the server config, is to just run a hello world script in the target directory with both extensions.