As your perl script is run by apache, LD_LIBRARY_PATH and PGLIB may
be defined *before* apache starting. If apache is run by a rc script,
define LD_LIBRARY_PATH and PGLIB in the rc script before apache is
started.
You do not need mod_perl for this script. mod_perl gives you the
benefits of having a persistant perl vm staying alive between the
execution of your cgi scripts. It will speedup things because you
can maintain a persistant state (your perl code compiled, your
database connections, ...) between executions of your scripts.
Rémi.
Kevin Lo writes:
> Rimi Lehn wrote:
>
> > Your script worked for me (I skipped everything related to
> > forms-lib), but :
> >
> > - /* xxxx */ C-style comments are not allowed by perl (line #2)
> > - you should $sth->finish() and $dbh->disconnect() at the end of your
> > script to avoid warnings ("Database handle destroyed without
> > explicit disconnect.")
>
> OK, added.
>
> > I assumed that your table course has two fields, both are
> > type text. Check that your fields are not numbers (inserted values
> > are quoted (line #13)).
> >
> > You can replace $sth->prepare() and $sth->execute() by a
> > $sth->do( "your query" ); as your query has no output row.
> >
> > Check your web server's logs. At least for apache, stderr
> > of cgi scripts is dumped in an error log. Try running your script
> > offline. A common mistake is not having access to your database
> > with the uid endorsed by your web server (apache usually runs
> > cgi scripts as nobody which may not have INSERT permissions on
> > the table).
>
> I checked the log file of Apache server, I got an error message:
>
> [Mon Jan 18 18:12:01 1999] [notice] httpd: caught SIGTERM, shutting down
> [Mon Jan 18 21:48:28 1999] [notice] Apache/1.3.1 (Unix) configured -- resuming
> normal operations
> install_driver(Pg) failed: Can't load
> '/usr/local/lib/perl5/site_perl/i386-freebsd/auto/DBD/Pg/Pg.so' for module DBD::Pg:
> Can't find shared library "libpq.so.2.0" at
> /usr/local/lib/perl5/i386-freebsd/5.00404/DynaLoader.pm line 166.
>
> at (eval 1) line 2
>
> at /home/kevin/public_html/example.pl line 14
>
> I've already set enviroment variables PGLIB and LD_LIBRARY_PAHT in .login.
> libpq.so.2.0 is in /usr/local/pgsql/lib directory. I don't install mod_perl with
> Apache.
> Should I install mod_perl? Would you tell me how to solve this problem, thanks.
>
> Best regards,
> Kevin.
>