使用oracle配置php
我想从 PHP 连接到 oracle。我下载了 php_oci8.dll 库,将其放在 php 的 ext 目录中,在 php.ini 文件中定义 extension=php_oci8.dll
并重新启动 Web 服务器。 我收到一条错误消息:调用未定义的函数 oci_connect()
。我发现php需要配置--with-oci8=path_to_library
。查看 php 配置( phpinfo() ),它在“配置命令”部分显示 --with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared
。
我在 Windows 7 机器上运行。
我怎样才能改变这一点?我还必须做什么才能让它发挥作用?
谢谢你!
i want to connect to oracle from PHP. I downloaded the php_oci8.dll library, put it in the ext directory of php, defined extension=php_oci8.dll
in my php.ini file and restarted the web server.
I get an error saying Call to undefined function oci_connect()
. I found out that php needs to be configured with --with-oci8=path_to_library
. Looking to the php configuration ( phpinfo() ) there it says --with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared
in the "configure command" section.
I am running on a windows 7 machine.
How can I change that ? And what else must I do to get it work ?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
仅当您想将库直接编译为 PHP 时,才需要使用 --with 选项。如果添加“扩展”参数没有加载 oracle 库,请检查您是否修改了正确的 php.ini。或者列出了 .dll 的正确路径。
通常有两个 php.ini。一种用于网络服务器操作,一种用于命令行。
您可以使用
phpinfo()
查看当前配置。如果加载了 Oracle 扩展,将会有一个部分列出其配置选项。The --with stuff is only if you want to compile a library directly into PHP. If adding the 'extension' argument didn't load the oracle library, then check that you modified the correct php.ini. Or had the correct path listed for the .dll.
There's usually two php.ini's. One for webserver operations, and one for command line.
You can see what the current configuration is with
phpinfo()
. If the Oracle extension's loaded, there'll be a section with its config options listed.在 Web 服务器上安装 Oracle 客户端(我怀疑你没有)。您至少需要类似 Oracle Instant Client连接到 Oracle。
请遵循 PHP 手册中有关如何设置环境的建议。顺便说一句,该页面还有一个关于故障排除的很好的部分。
Install an Oracle client on the web server (I suspect you didn't). You need at least something like Oracle Instant Client to connect to Oracle.
Follow the advice in the PHP Manual on how to setup your environment. That page also has a nice section on troubleshooting BTW.
我创建了一个在 OS X 上使用 Oracle 设置 PHP 的教程。
可以轻松转移到 Linux(尽管即使您使用的是 Oracle 11,也要记得下载 Oracle 10 驱动程序)。
I created a tutorial for setting up PHP with Oracle on OS X.
Can be easily transferred to Linux (though there remember to download the Oracle 10 drivers even if you are using Oracle 11).