我有一个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
发布评论