Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1] 2   Go Down
Print
Author Topic: fopen error  (Read 743 times)
0 Members and 1 Guest are viewing this topic.
mdlipay
New Member
*

Karma: 0
Offline Offline

Posts: 1

web designer


WWW
« on: April 19, 2006, 07:53:00 PM »

I am receiving an fopen error when I try to run the calendar.cgi script. I have successfully executed the calendar_admin.cgi, but the calendar.cgi and debug.cgi will not execute. When I look at the server log there is a message:

[Wed Apr 19 20:45:32 2006] [error] [client 68.170.0.35] fopen: Permission denied
[Wed Apr 19 20:45:32 2006] [error] [client 68.170.0.35] Premature end of script headers: debug.cgi

Now, if I add -w or -d to the perl statement it works fine, but I get a hell of a lot of messages generated.

As far as the permissions, I can't find a file under /calendarscript which are not set to 777, file extensions were changed to .cgi

When I run debug.cgi with -w I get the Success! message.

thanks in advance,

mike

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: April 19, 2006, 08:51:00 PM »

** I can't find a file under /calendarscript which are not set to 777 **

How did you install it and what permissions are allowed on your server? 777 is not allowed on many servers as it can be a security concern.

On every server I've installed, only the .pl (in your case .cgi) files and their directory needed to be chmod to 755. All the rest only 666.

** if I add -w or -d to the perl statement it works fine, but I get a hell of a lot of messages generated **

For the -w that is to be expected as it is telling Perl to display warnings which is usually only useful during script development. What does your host's CGI FAQs say to use as the shebang?

Dan O.

------------------

Logged
mdlipay
New Member
*

Karma: 0
Offline Offline

Posts: 1

web designer


WWW
« Reply #2 on: April 20, 2006, 03:15:00 AM »

Took some digging on their site, but the max permissions are 755. I changed them to 744 as per CS documentation. debug now works, but calendar still does not. Checking the log I see the following errors:

[Thu Apr 20 04:05:54 2006] [error] [client 207.46.98.131] File does not exist: /usr/local/plesk/apache/vhosts/kta-hike.org/httpdocs/robots.txt
[Thu Apr 20 04:05:54 2006] [error] [client 207.46.98.131] File does not exist: /usr/local/plesk/apache/vhosts/kta-hike.org/httpdocs/mid.htm

I don't see anything in your docs about these two files.

------------------

Logged
mdlipay
New Member
*

Karma: 0
Offline Offline

Posts: 1

web designer


WWW
« Reply #3 on: April 20, 2006, 09:05:00 AM »

OK, found out about robots.txt files, got that straightened out. Here's where I am:

- debug.cgi works fine, no errors reported
- I can launch calendar_admin.cgi and perform most functions, the only one which I tried but could not get to work was "View Calendar" -- I did not try adding events
- I can create users and calendars
- I can maintain calendar preferences

What does not work:

- "View calendar" from calendar_admin.cgi
- calendar.cgi

both return the following errors:

[Thu Apr 20 09:57:48 2006] [error] [client 12.46.238.11] failed to open log file /var/log/httpd/suexec_log, referer: http://kta-hike.org/cgi-bin/calendar_admin.cgi

[Thu Apr 20 09:57:48 2006] [error] [client 12.46.238.11] fopen: Permission denied, referer: http://kta-hike.org/cgi-bin/calendar_admin.cgi

[Thu Apr 20 09:57:48 2006] [error] [client 12.46.238.11] Premature end of script headers: calendar.cgi, referer: http://kta-hike.org/cgi-bin/calendar_admin.cgi

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #4 on: April 20, 2006, 12:47:00 PM »

** Premature end of script headers: calendar.cgi, **

I'm afraid all the message means is the script failed to run but says nothing about why. You (or your host's support) could try running the script from the command line (telnet, SSH, etc.) to see what error(s) Perl reports.

Dan O.

------------------

Logged
mdlipay
New Member
*

Karma: 0
Offline Offline

Posts: 1

web designer


WWW
« Reply #5 on: April 20, 2006, 01:36:00 PM »

I've been trying to debug it myself, ISP isn't the greatest (support outsourced overseas, limiting the time that they are available).

I ran the script with the -t option, this is what I see:

[Thu Apr 20 14:22:04 2006] [error] [client 12.46.238.11] Insecure dependency in require while running with -t switch at calendar.cgi line 40.


[Thu Apr 20 14:22:04 2006] [error] [client 12.46.238.11] Insecure dependency in eval while running with -t switch at /usr/local/plesk/apache/vhosts/kta-hike.org/cgi-bin/calendarscript/lib/asp.inc line 9.

[Thu Apr 20 14:22:04 2006] [error] [client 12.46.238.11] Insecure dependency in open while running with -t switch at /usr/local/plesk/apache/vhosts/kta-hike.org/cgi-bin/calendarscript/lib/CGISession.inc line 126.


Looking at line 126 in CGISession.inc:

sub saveSession {
   my ($self) = shift;
   if ($self->isValid()) {
      delete $self->{"_isnew"};
      my ($filename) = $self->fileName();
      open(OUT,"> $filename") | | &FATALERROR("Session file [".$self->fileName()."] could not be opened for writing!");
      foreach $name (keys %$self) {
         print OUT "$name=".$self->{$name}."\n";
         }
      close(OUT);
      }
   }


------------------

I have tested all of the functions under calendar_admin.cgi and, with the exception of "view calendar" everything works fine. Is this of any help?

Also, I don't see the error message that the function should return if there is an error (FATALERROR), where (or how) could I see that?

[This message has been edited by mdlipay (edited April 20, 2006).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #6 on: April 20, 2006, 04:28:00 PM »

** I ran the script with the -t option **

Doesn't help.

** Insecure dependency in require...  **

Those are just warning and should not affect running of the script.

** I have tested all of the functions under calendar_admin.cgi and, with the exception of "view calendar" everything works fine. Is this of any help? **

No, other than knowing for sure that calendar_admin.cgi isn't the problem.

Do you have shell access to be able to run the calendar.cgi file (without any -t -w flags/switches) directly to see what error(s) Perl reports??

Dan O.

------------------

Logged
mdlipay
New Member
*

Karma: 0
Offline Offline

Posts: 1

web designer


WWW
« Reply #7 on: April 20, 2006, 07:09:00 PM »

No, they don't allow telnet access into their site.

------------------

Logged
mdlipay
New Member
*

Karma: 0
Offline Offline

Posts: 1

web designer


WWW
« Reply #8 on: April 20, 2006, 08:27:00 PM »

This is what I get without the -t

Can't open perl script "\r": No such file or directory.
Use -S to search $PATH for it.

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #9 on: April 20, 2006, 09:18:00 PM »

** No, they don't allow telnet access into their site **

But they should be able to.

How about SSH or SSH2?

** This is what I get without the -t - Can't open perl script "\r": **

Sorry, I have no idea what that might be referring to.

I can't see there being anying in the script's code which could be responsible if the administration script works. Have you tired re-uploading a fresh copy of that script. Maybe it got corrupted in the initial upload?

Dan O.

------------------

Logged
mdlipay
New Member
*

Karma: 0
Offline Offline

Posts: 1

web designer


WWW
« Reply #10 on: April 20, 2006, 09:30:00 PM »

Yes, I have uploaded it more than once. I am trying to contact the ISP, but they are not very responsive.

Thinking the $BASE may need to be populated, does this look correct:

$BASE_DIR = "/usr/local/plesk/apache/vhosts/kta-hike.org/cgi-bin/calendarscript/";

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #11 on: April 21, 2006, 12:31:00 AM »

It looks like a path, I have no idea if it is your path or not.

But even if so, if the $BASE_DIR variable needed to be set, it would be needed in all 3 of the .pl files, not just the calendar.pl file... which is apparently not the case since you say the other scripts run.

JFYI

Dan O.

------------------

Logged
mdlipay
New Member
*

Karma: 0
Offline Offline

Posts: 1

web designer


WWW
« Reply #12 on: April 21, 2006, 04:08:00 AM »

Finally received a response from the ISP, though after I modified the $BASE, here is what they see:

./calendar.cgi: line 10: BEGIN: command not found
./calendar.cgi: line 13: =: command not found
./calendar.cgi: line 17: syntax error near unexpected token `{'
./calendar.cgi: line 17: `      if ($BASE_DIR ne "") { $BASE_DIR =~ s|([^/])
$|$1/|; }'

Here is the beginning of the script:

#!/usr/bin/perl
#
# CalendarScript
# Version: 3.21
#
# Copyright 2003 Scott
# http://www.CalendarScript.com/
#

BEGIN {
   # CHANGE THE LINE BELOW IF NECESSARY
   # Be sure to remove the # before $BASE_DIR, and change the path between the quotes
   $BASE_DIR = "/usr/local/plesk/apache/vhosts/kta-hike.org/cgi-bin/calendarscript/";

   # DO NOT CHANGE ANYTHING BELOW HERE!

   if ($BASE_DIR ne "") { $BASE_DIR =~ s|([^/])$|$1/|; }
   else {
      my ($path) =  $ENV{'PATH_TRANSLATED'} | | $ENV{'SCRIPT_FILENAME'};
      unless ($path) {
         print "Content-type:text/html\n\n<B>ERROR:</B><BR>Your server does not provide the PATH_TRANSLATED or SCRIPT_FILENAME environment variables.<br><br>Please see the installation documentation for how to set the \$BASE_DIR variable manually.";
         exit(0);
         }
      $path =~ s|[^/\\]*$| |;
      $path =~ s|([^/])$|$1/|;
      $BASE_DIR = $path . "calendarscript/";
      }

------------------

Logged
mdlipay
New Member
*

Karma: 0
Offline Offline

Posts: 1

web designer


WWW
« Reply #13 on: April 21, 2006, 10:09:00 AM »

** On every server I've installed, only the .pl (in your case .cgi) files and their directory needed to be chmod to 755. All the rest only 666.

I was just re-reading your comment above, and the install instructions. The instructions say:

"In some situations, web hosts do not allow files in or under the cgi-bin to be chmod 777, for security reasons. These are often situations where the scripts run as your own user ID, not as a user like 'nobody'. If you verify with your web host that this is the case for your site, then you should CHMOD 744 the 'calendarscript' directory and all files under it."

This is what I did; however, your comments above state to CHMOD 666. which is correct???

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #14 on: April 21, 2006, 05:32:00 PM »

** ./calendar.cgi: line 10: BEGIN: command not found **

I don't know why that would be, it used in the calendar_admin.pl file too! Maybe check all lines above that one for problems.

** ./calendar.cgi: line 13: =: command not found **

I don't know where that's coming from if what you've posted of your file is correct.

** ./calendar.cgi: line 17: syntax error near unexpected token `{' **

Again, I don't know what would be causing such an error message besides an error in one of the preceding lines...if what you've posted of your file is correct.

** your comments above state to CHMOD 666. **

666 is both read and write permissions (which is what the scripts need to read and write to files) but not execute permissions (which can be the security problem). If the script runs Ok under just 744 than great! Every server is different, check your host's CGI FAQ's for what is acceptable on their servers.

Dan O.

------------------

Logged
Pages: [1] 2   Go Up
Print
Jump to: