Consultor Eletrônico



Kbase P155299: PHP script fails when being ran from a web browser via Apache
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   9/21/2010
Status: Verified

SYMPTOM(s):

PHP script fails when being ran from a web browser via Apache

SQL error: [unixODBC][DataDirect][ODBC 20101 driver]1201, SQL state 60 in SQLConnect

Using the PHP apache_setenv variable in the PHP script to set the LD_LIBRARY_PATH does not change the behavior.

FACT(s) (Environment):

PHP script works fine within a bash script.
PHP script contains a line that sets the LD_LIBRARY_PATH.

Example: putenv("LD_LIBRARY_PATH=/u/apps/progress/dlcv91e/odbc/lib:/u/apps/progress/dlcv91e/lib");
Linux
Progress 9.1E

CAUSE:

The LD_LIBRARY_PATH needs to be set prior to Apache being started. Setting the LD_LIBRARY_PATH within the PHP script is insufficient. It needs to be set prior to the PHP script being invoked.

FIX:

Set the LD_LIBRARY_PATH environment variable prior to the startup of Apache. Example: Setting LD_LIBRARY_PATH in /etc/init.d/httpd.