Author Topic: Error showing the newsscript  (Read 1984 times)

0 Members and 1 Guest are viewing this topic.

Offline GMF

  • Newbie
  • *
  • Posts: 2
Error showing the newsscript
« on: August 21, 2011, 07:17:06 AM »
Hi

I have newsscript on a website i designed for my uncle's restaurant and it has worked fine for the past two years. Recently I checked it out though and found that the news headlines weren't loading, instead, the following error was displayed:

'[an error occurred while processing this directive]' (also see: http://www.goodmoodfoodcafe.com/index.shtml)

I have no idea why it would show this, and it has been two years since I set up the script so I thought I might check if anyone else has had this problem or knows what it means before I start messing with the options in the codes.
The website was working fine last time I checked, and no alterations have been made since that time. No news items have even been added (It's not often that we add new items). The login still works, and the old posts are still saved on the server. I added a new post called test to see if it would display, but it didn't. Our hosting server still supports cgi and perl, and I get the error on both IE and Firefox (current versions).

I have no idea what could be causing the problem? especially since the error message doesn't give much information either. Does anyone have any idea?

Any help would be appreciated, thanks in advance!

Offline NDboots

  • Newbie
  • *
  • Posts: 9
Re: Error showing the newsscript
« Reply #1 on: September 03, 2011, 11:33:18 PM »
I looked at the EZ News Script website and they are having the same problem.  I think it has to do with changes/updates with how SSL and CGI are handled on the server.  I ran into the same problem with my webhost moving me to a new server.  Anyway, after working on this too long these changes seemed to work for me.  So, maybe you can take a look and see if your webhost made any of these changes.

1. First, they moved my cgi-bin inside my public folder where the rest of my files are.  Before it was outside the public folder.  So, on the webpage itself, I had to change the location to call the newsscript.pl from.  If your lucky...maybe that's all you have to do...

2. My webhosts "moving software" seemed to have made changes to the newsscript.pl randomly "here and there" also.  So, I got the original copy of the newsscript.pl and reset from that.  If you want to try that, just rename the file in your webhost cgi-bin to newsscript-bkup.pl  Or backup a copy to someplace on your computer. That way you will have it to go back to and study, just incase nothing you try works.

3. They changed my path to perl (on the first line of the script).  It was no longer: !/usr/bin/perl5.8.3 which they required before in the past,  Now it was a standard:  !/usr/bin/perl  
So, you might want to check your control panel to see if there were any changes made by your webhost, to your "path to perl".

4.  Then I had to work on this section of lines, just ten lines or so down:
my $script_name                  = 'http://www.your-url.com/cgi-bin/newsscript.pl';
my $databasefile                  = "news.txt";
my $idField                     = "ID";
my $image_dir                     = "images";              
my $image_url                     = "http://www.your-url.com/cgi-bin/images";      
my $html_template               = "headlines.htm";        
my $record_template            = "news.htm";

This one gave me trouble too, before I did not use the www.  But to get my script to work on the new server, I had to include the www.  So, you might want to test to see if adding or removing the www. helps.  AND I had to put the double quote (") on this one, the single quote (') did not work:
my $script_name                  = "http://www.your-url.co.uk/cgi-bin/newsscript.pl";

For this one I had to change it to the "Path" to the image files.  The old server had a different path.  So, you could try checking with your webhost to get the path to your main file directory.  It might look something like below, or may start out with /home/users/web/ or something like that:
my $image_dir                     = "$ENV{'HOMEDIR'}/cgi-bin/images";  

For this one for images, the same with the www. I had to include that in the URL for the new sever I'm on:
my $image_url                     = "http://www.your-url.co.uk/cgi-bin/images";

And those were the changes I had to do to get the script to work again for me with the new webhost's server.  I don't know if any of these would work for you, but maybe you could give each one a try like I did, until you find something that works again.  But I had to do all these to get the script to function again after the move to the new server.
« Last Edit: September 03, 2011, 11:38:51 PM by NDboots »

Offline GMF

  • Newbie
  • *
  • Posts: 2
Re: Error showing the newsscript
« Reply #2 on: September 06, 2011, 03:40:36 PM »
Hi NDboots, thanks for your reply!

I tried the things you suggested, but they haven't worked for me. My server hadn't changed anything around, and the path to perl was still the same. I also found out the test cgi script from the newsscript website still worked fine, so path to perl is ok.
I also tried playing with the single/double qotes and the www's, with no effect.

i'm now going to try and take everything off, and downloading and configuring the script again, maybe that works

Offline NDboots

  • Newbie
  • *
  • Posts: 9
Re: Error showing the newsscript
« Reply #3 on: September 27, 2011, 02:49:43 PM »
Well, my newscript continues to work on the one webhost with the changes I made above.  But another non-profit group website I work on now and then, the different webhost there updated Perl and I got same message to deal with again: "an error occurred while processing this directive".  The above tricks did not work on this webhost.  I'm using the full version of the newscript, and I'm just learning Perl a little, very far away from expert.

I still see the EZnewscripting.com website showing the "an error occurred while processing this directive" error message too.

So, at the top of the newscript.pl I added a second line (for trouble shooting purposes) so that it reads like this:
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
##########################################################

Now, if I refresh the page view on the website, I can get actual error messages via the browser.  The error I was getting started out like this:
"Reference to invalid group 0 in regex; marked by <-- HERE.......etc. etc.

Which all lead to a problem with this section, which is about in the area of line 780 in the script:
   if($select_image){
    opendir(DIR, "$image_dir");
    foreach(readdir DIR)
{
         $img_select.="<option>$_</option>\n" if -f "$image_dir/$_" && $_=~m/.\gif|.\jpg/i;
      }
    close DIR;

So, after spending some time hunting, I changed the one line to read this to try to correct the "regex" problem.  I more or less added a space between the squiggle and the letter m (for matching), then added a \Q after the m/ :
          $img_select.="<option>$_</option>\n" if -f "$image_dir/$_" && $_=~ m/\Q.\gif|.\jpg/i;

Now with this webhost, which is Dreamhost, the script is working again, for viewing and most editing.  So, far I have only one problem, in the Admin, edit window.  I can upload new images, but it's not listing them in the dropdown, the .gif or .jpg files in my image folder.  Otherwise, all the other features seem to work, for the most part, for the viewer/admin area again for this website...for now.  Maybe someone can help us with a better "fix-it" with this section of the script? 

Offline dejabeuk

  • Newbie
  • *
  • Posts: 1
Re: Error showing the newsscript
« Reply #4 on: January 17, 2012, 12:34:56 PM »
@NDboots
Thank you thank you thank you.

I have been struggling with exactly the same problem for 2 weeks since my isp (123-reg) changed something (I can't find out what) on their servers. Their support simply will not address the problem and I have been trying evrything for a number of my sites which depend on NewsScript. I was on the point of changing my host - but this works!!

Thanks again.