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

Web Technologies Web Development 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating
_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.

Posted on 16 Aug 2022, this text provides information on Web Development related to Web Technologies. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

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

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.

Important Web Technologies Links