ODBC_connect仅与psql用户一起运行 [英] ODBC_connect runs only with psql user

查看:97
本文介绍了ODBC_connect仅与psql用户一起运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个php脚本,可以从odbc数据库(普及型客户端)中查询数据.

I have a php script who ask data from a odbc database (pervasive client).

当我以psql用户(由安装程序创建)在CLI中运行脚本时,则我没有问题,脚本便运行了.

When i run the script in CLI as the psql user (which the installer created) , then i have no problems and the script runs.

当我在浏览器中(作为www-data)或在CLI中以root身份或cronjob身份运行脚本时,我会收到错误消息:

When i run the script in browser ( as www-data) or in CLI as root or as a cronjob then i receive the error :

PHP Warning:  odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib '/usr/local/psql/lib64/libodbcci.so' : file not found, SQL state 01000 in SQLConnect in /var/ww....

我已经添加了用户www-data&根植于普及型客户端已安装的组中.

i have added the user www-data & root in the groups that the pervasive client has installed.

一切都在Debian服务器上运行.

Everything runs on a Debian server.

推荐答案

解决方案,如注释所示

为需要执行任务的每个用户和进程设置环境变量,以匹配对PHP和psql用户有效的环境.

Set the environment variables for each user and process that needs to perform the task, to match the environment that was active for PHP and the psql user.

这是通过使用shellscript完成全部任务来实现的.

This was achieved by using a shellscript for the full task.

这篇关于ODBC_connect仅与psql用户一起运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆