Skip to main content

Problem:

Error returned by Apache server when attempting to run a COBOL application

error while loading shared libraries: libcobrts.so: cannot open shared object file: No such file or directory; Premature end of script headers: myapp

Resolution:

The error is returned because the path to the Cobol libraries was not set at the time Apache attempted to run the program.    

If you are not using the cobrun triggers - run the app from a script that sets the environment.

#! /bin/sh

COBDIR=/MyCobolDirectory

PATH=$COBDIR/bin:$PATH

LD_LIBRARY_PATH=$COBDIR/lib:$LD_LIBRARY_PATH

export COBPATH COBDIR PATH LD_LIBRARY_PATH

cobrun mycgiapp  $*

Then run the script from your input form:

<FORM ACTION="/cgi-bin/runapp">

Old KB# 2264