Apache FastCGI Python Linking Error

I have a FastCGI web service that I am working on that is currently broken because of the following error:

ImportError: /proj/issm-web/trunk/lib/IssmConfig.so: undefined symbol: PyUnicodeUCS2_FromString

The reason for this error is that I am using a different installation of Python than the system wide installation. Apparently, when I restart the Apache2 server the wrong library is picked up!

To solve this I attempted to modify:


To this file I appended the following:

 export LD_LIBRARY_PATH="/proj/issm-web/trunk/externalpackages/python/install/lib:${LD_LIBRARY_PATH}"
 ldd `which python` >> ${TEST_FILE}

This gives the satisfactory result:

linux-vdso.so.1 =>  (0x00007ffff25ff000)
libpython2.7.so.1.0 => /proj/issm-web/trunk/externalpackages/python/install/lib/libpython2.7.so.1.0 (0x00007f236db18000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f236d8db000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f236d51b000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f236d317000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f236d114000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f236ce17000)
/lib64/ld-linux-x86-64.so.2 (0x00007f236def2000)

In other words, not only is the right Python executable being launched, but the right library is being picked up!

Furthermore, I can confirm that:


Contains the appropriate symbol:

readelf -s $ISSM_DIR/externalpackages/python/install/lib/libpython2.7.so.1.0 | grep'PyUnicodeUCS2_FromString'
316: 00000000000bd0e0   312 FUNC    GLOBAL DEFAULT   11 PyUnicodeUCS2_FromStringA
606: 00000000000bd220    58 FUNC    GLOBAL DEFAULT   11 PyUnicodeUCS2_FromString
4036: 00000000000bd0e0   312 FUNC    GLOBAL DEFAULT   11 PyUnicodeUCS2_FromStringA
4241: 00000000000bd220    58 FUNC    GLOBAL DEFAULT   11 PyUnicodeUCS2_FromString

Unfortunately, I am still seeing the same error. The only thing that I can think of is that the environment variables I am setting are not being respected when I restart Apache.

Here is some information that might be useful:

apache2 -version
Server version: Apache/2.2.22 (Ubuntu)
Server built:   Jul 12 2013 13:37:10

uname -a
Linux thwaites 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Can anyone help me solve this problem?


The problem ends up being with how FastCGIServer is launched. Unfortunately, environment variables are not propagated from Apache by default.

In order for LD_LIBRARY_PATH to be passed down to FastCGIServer, I had to modify


To include:

 -initial-env LD_LIBRARY_PATH

When launching the FastCGIServer.

Need Your Help

lock all submit button before page fully rendered

javascript jquery

may i know how to use jquery to lock all the <input type="submit/button" .. and only allow submit when page is fully rendered?

Getting LINQ Exception handling in the query

c# sql linq

var lstgroupCode = (from g in _context.ALM_USER_GROUP_MSTs where g.isShiftAvailable == true select g.User_Group_Code).ToList();