PHP interpreter gets undefined constant OCI_COMMIT_ON_SUCCESS with ADODB(PHP 解释器使用 ADODB 获取未定义的常量 OCI_COMMIT_ON_SUCCESS)
问题描述
我写了一个必须在 php 解释器(没有 Apache)上运行的 php 脚本,它使用带有 Oracle 数据库的 adodb 库,但是当我尝试运行它时,出现以下错误:
I wrote a php script that must be run on the php interpreter (Without Apache), which uses the adodb library with an Oracle database, but when I try to run it, I'm getting the following error:
我已经检查过,并且启用了 php_oci8 和 php_oci8_11g,因此应该定义常量.此外,当我使用 Apache 运行此脚本时,它可以正常工作.
I've checked, and have both the php_oci8 and php_oci8_11g enabled, so the constant SHOULD be defined. Also, when I run this script WITH Apache, it works without any problems.
提前致谢!
推荐答案
经过快速搜索,我找到了 本页.如果您的 php.ini 中没有启用 oracle 扩展,则该常量未定义.尝试搜索该行
After a quick search I found this page. If you don't have the oracle extension enabled in your php.ini then the constant is undefined. Try searching for the line
在你的 php.ini 中删除分号以取消注释.然后重启Apache加载模块,看是否连接.
in your php.ini and remove the semicolon to uncomment it. Then, restart Apache to load the module and see if it connects.
尝试通过执行诸如 print_r(ini_get_all())
之类的操作来转储 php.ini 变量,然后查看已设置和未设置的内容.您可能在命令行中使用了不同的 php.ini.
Try dumping the php.ini variables by doing something like print_r(ini_get_all())
and see what is set and what isn't. You may be using a different php.ini for the command line.
这篇关于PHP 解释器使用 ADODB 获取未定义的常量 OCI_COMMIT_ON_SUCCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!