[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question re Manual Install



On September 4, 2002 at 17:52, Gunnar Hjalmarsson wrote:

> > We had intended to install and run MHonArc on the same server as the web
> > site, for which we have a commercial shared hosting package. The package
> > allows CGI but there is no shell access. We seem to have overestimated the
> > extent to which the system can be driven via a web interface.
> > 
> > In the light of your reply (and a closer inspection of the FAQ!) ...
> 
> I have to say that I think Earl is kind of exaggerating the 
> difficulties.

I do not think I was "exaggerating" the difficulties.  However,
Frank appears to be new to some aspects so it appears to be difficult
for him vs someone who is comfortable with the command-line and/or
editing source files.

> When you install a Perl script on such an account, you 
> simply extract the zip file on the hard disk of your PC, do the 
> necessary editing (in this case according to the manual install 
> instructions), and upload the files.

A potential snag is if the hosting service uses a chrooted environment
for the web server that differs from ftp access (i.e. the directory
paths were different between the web server and the ftp server).
I've have correspondance with one user in the past where this was
the case.

> As regards invoking the program, I'm using a simple CGI script (which 
> btw includes a part, that adds the ability to grab the mails from any 
> POP3 account, and which Earl helped me with ;-). See 
> http://www.mhonarc.org/archive/html/mhonarc-users/2002-05/msg00014.html
> 
> If I were Mark, I'd go for the original plan. Feel free to use my little 
> script, if you like. I'm ready to answer a question or two if you need it.

You may want to have a test operation for you CGI program that checks
that things will work properly.  For example, the program blindly does:

  require 'mhamain.pl';

I would wrap this in a function that check if it fails.  For example
(using your error reporting and coding style):

  sub load_mhonarc {
    if (defined(&mhonarc::process_input)) {
      # mhonarc library already loaded
      return;
    };
    eval {
      unshift(@INC, $lib);
      require 'mhamain.pl';
      mhonarc::initialize();
    };
    if ($@) {
      print "Content-Type: text/plain\r\n\r\n",
	    "Error: Unable to load mhonarc: $@\n";
      exit 0;
    }
  }

This avoids the "Internal Server Error..." message with no clue on
what went wrong since you can read the error logs.  In general, I
would wrap the main block for the CGI program in an eval block so
any die()'s are caught.


BTW, if the CGI is the only way mhonarc will be called on the system,
installing mhonarc can be made easier.

What you do is extract the mhonarc distribution on your local PC.
Then just ftp the files over to your web hosting server (you may want
exclude the doc directory since that contains alot files, and is not
needed to run mhonarc).  There should be no need to edit any of
the files as stated in the Manual Installation section.

Then in CGI program (assuming it is in Perl), add the following line
to the beginning:

  use lib '/path/to/mhonarc/lib';

An invoke mhonarc via the API interface (like what Gunnar has done).

It appears Gunnar's does something that is equivalent when you set
the $lib variable at the top.

--ewh

---------------------------------------------------------------------
To sign-off this list, send email to majordomo@mhonarc.org with the
message text UNSUBSCRIBE MHONARC-USERS


[Index of Archives]     [Bugtraq]     [Yosemite News]     [Mhonarc Home]