Project

General

Profile

[Solved] PERL5LIB and cgi

Added by AlbertB over 5 years ago

Hi,

I have got a lighttpd 1.4.50 server running on Archlinux for ARM. I configured cgi and simple Perl srcipts run just fine. However I'd like to use some custom Perl modules. On command line one way to do this is to set PERL5LIB. Therefore I thought setting PERL5LIB in lighttpd.conf using setenv.add-environment should do it. But it doesn't seem to work.

Here is my lighttpd.conf:

# This is a minimal example config
# See /usr/share/doc/lighttpd
# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions

server.port             = 80
server.username         = "http" 
server.groupname        = "http" 
server.document-root    = "/srv/http" 
server.errorlog         = "/var/log/lighttpd/error.log" 
dir-listing.activate    = "enable" 
index-file.names        = ( "index.html" )
mimetype.assign         = (
                                ".html" => "text/html",
                                ".txt" => "text/plain",
                                ".css" => "text/css",
                                ".js" => "application/x-javascript",
                                ".jpg" => "image/jpeg",
                                ".jpeg" => "image/jpeg",
                                ".gif" => "image/gif",
                                ".png" => "image/png",
                                "" => "application/octet-stream" 
                        )

server.modules = (
  "mod_access",
  "mod_fastcgi",
  "mod_cgi",
  "mod_accesslog" )

cgi.assign = (".pl" => "/usr/bin/perl", ".sh" => "/bin/bash")

setenv.add-environment = (
        "PERL5LIB" => "/home/alarm/my_site_lib" 
)

Obviously I am doing it wrong. This is the output of /var/log/lighttpd/error.log after a restart.

2018-09-11 14:00:30: (server.c.1430) server started (lighttpd/1.4.50)
2018-09-11 14:00:30: (server.c.1459) WARNING: unknown config-key: setenv.add-environment (ignored)

What am I missing?

Best regards,
Albert


Replies (1)

RE: PERL5LIB and cgi - Added by AlbertB over 5 years ago

Seems that I forgot to enable the setenv server module. With this configuration it works much better now:

server.modules = (
  "mod_setenv",
  "mod_access",
  "mod_fastcgi",
  "mod_cgi",
  "mod_accesslog" )
    (1-1/1)