ODBC

编程入门 行业动态 更新时间:2024-10-28 04:22:29
本文介绍了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

本文发布于:2023-10-28 02:38:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535266.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ODBC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!