How to import LD_LIBRARY_PATH for python script? No root access. No permission to restart apache server

Web Technologies Web Development 3 years ago

6.33K 1 0 0 0

_x000D_ _x000D_ I have a shared hosting in GoDaddy hosting service.It has the following limitations. No root access No permission to restart apache server My hosting service system and applications specifications. Postgres 10.7 python3 OS -- Linux version 2.6.32-896.16.1.lve1.4.54.el6.x86_64 (mockbuild@buildfarm03.cloudlinux.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) I use a cgi script to redirect the apache server to my Python script. When Python tries to import the psycopg2 module, the following error is thrown /home/user/python_base/lib/python3.4/site-packages/psycopg2/_psycopg.cpython-34m.so: undefined symbol: PQescapeIdentifier I exported the postgresql/lib path to LD_LIBRARY_PATH and restarted the Python script locally and it works fine. But since I cannot restart the apache server, I guess the process in which the apache is running does not have the LD_LIBRARY_PATH updated. So the error persists. I have a python environment running. I copied all the library files from postgresql/lib to mypythonenv/lib, still in vain.

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 years ago
_x000D_ You could set the environment variable in os.environ before importing psycopg2.
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum


Q

Unity hosting a custom piece of code on own website [on hold]

_x000D_ _x000D_ I was wondering how would you be able to host an "API" on your own website that you...
Q

I am needing advice on a web bot [on hold]

_x000D_ _x000D_ I want to code a bot that has a GUI or CLI doesn't really matter yet but a GUI would...
Q

date and time picker, that can take a max and min absolute time, compatible with react [on hold]

_x000D_ _x000D_ I have an issue with scheduling things in a web platform (react.js), and need a date...

Important Web Technologies Links