perlapache2mod-perl2

Error while loading mod_perl.so


I have installed perl-5.8.9, mod_perl-2.0.7, Embperl-2.3.0 and httpd-2.2.22. And while starting apache, I get the error like the following (broken into multiple lines for readability):

httpd: Syntax error on line * of ../conf/httpd.conf:
   Cannot load ../Apache2/mod_perl.so into server:
      libperl.so: cannot open shared object file:
         No such file or directory

And by doing ldd ../Apache2/mod_perl.so, I got the output like

    linux-gate.so.1 =>  (0x00735000)
    libperl.so => not found
    libnsl.so.1 => /lib/libnsl.so.1 (0x005e5000)
    libdl.so.2 => /lib/libdl.so.2 (0x00fab000)
    libm.so.6 => /lib/libm.so.6 (0x0041f000)
    libcrypt.so.1 => /lib/libcrypt.so.1 (0x0084d000)
    libutil.so.1 => /lib/libutil.so.1 (0x00110000)
    libc.so.6 => /lib/libc.so.6 (0x00197000)
    /lib/ld-linux.so.2 (0x00163000)

Solution

  • [The question could usefully be moved to the Unix & Linux SE.]

    You appear to have installed not-quite-compatible packages, or one or more packages did not install properly, or the installation instructions are missing a step, or the dynamic linker defaults are not as expected.

    libperl is (unsurprisingly) part of perl. On some platforms a normal perl default build will create only the libperl.a static library, though it is possible to create a dynamic library libperl.so instead, or both. Some people favor the .so approach, though it can have some performance overheads.

    The most likely causes of your problem are:

    1. the installed perl has only static libperl.a, but mod_perl was built against a dynamic perl with libperl.so
    2. the perl package installed libperl.so somewhere the dynamic linker doesn't look

    Addressing cause #1 means finding different, compatible packages (or perhaps a combined package).

    If it's #2, you should be able to locate libperl.so (somewhere like /usr/local/lib/perl5/5.8.9/mach/CORE/), or just run ldd /usr/local/bin/perl (wherever the new perl binary installed to) to see if it knows where it is.

    Before you try any of the changes suggested below, just run ldconfig as root then try again, in case that fixes it.

    If you find libperl.so under the new perl installation directory, then you can copy that file to your Apache lib/ sub-directory as Apache should be built (with an ELF RPATH) to include that directory in the library search path. If you find it under /usr/local/lib then you should modify your default linker configuration (/etc/ld.so.conf) to include that directory, and refresh (run ldconfig as root).

    Your platform is evidently Linux, but you don't state the type and origin of packages, or whether it's a source build, so I can't be more precise...

    I'm slightly suspicious that something didn't install properly because the conventional place for Apache modules is within the modules/ sub-directory, not directly in the ServerRoot.