PHP 与 Oracle DB 的连接
我目前正在尝试编写一个 PHP 脚本来连接到 Oracle 数据库。我使用 PHP 的原因是因为我需要将 Oracle 数据库与我当前用 PHP/MySQL 编写的 CRM 系统连接起来。
PHP 托管在 1&1 托管上,这是一个外部服务器。我读到我需要启用扩展 php_oci8.dll 才能使用 oci_connect() 进行连接,但我无法这样做,因为我没有 root 权限。搜索了一下,也没有找到DLL。
还有其他办法解决这个问题吗?非常感谢任何帮助,如果您需要更多信息,请告诉我。谢谢!
I am currently trying to write a PHP script to connect to an Oracle database. The reason I am using PHP is because I need to connect the Oracle database with my current CRM system, written in PHP/MySQL.
The PHP is hosted on 1&1 hosting, which is an external server. I read that I need to enable the extension php_oci8.dll to connect using oci_connect(), but I cannot do so since I do not have root privileges. Did a search, and couldn't find the DLL either.
Is there any other way around this? Any help greatly appreciated, please let me know if you need more information. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
1) 1&1 将有 Linux,因此您必须使用 Linux 名称进行扩展。在这种情况下,扩展名将是
php_oci8.so
2) 在根目录中创建
php.ini
并添加以下行extension=php_oci8.so
3)创建一个简单的PHP脚本,用一行来测试它是否有效:
请注意 - 1&1 可能在其服务器上实际上没有可用的文件(或该扩展可能需要的一些附加库)。如果问题只是缺少 .so 文件,那么您可以提供您自己的版本(上传它并将正确的完整路径放入 php.ini 中的扩展名)
有用的链接:1) http://faq.1and1.com/scripting_languages_supported/php/6.html 2) http://faq.1and1.com/scripting_languages_supported/php/8.html
1) 1&1 will have Linux, so you will have to use linux names for extensions. In this case name of extension will be
php_oci8.so
2) create the
php.ini
in root directory and put the following lineextension=php_oci8.so
3) create a simple php script with one line to test if it works:
<?php phpinfo(); ?>
Please note -- 1&1 may physically not have that file available on their server (or some additional libraries that may be required by that extension). If the problem just with absence of .so file, then you can provide your own version of it (upload it and put the correct full path to the extension in php.ini)
Useful links: 1) http://faq.1and1.com/scripting_languages_supported/php/6.html 2) http://faq.1and1.com/scripting_languages_supported/php/8.html
根据你的问题。首先,Linux 不支持.dll 文件。
您必须在 Apache 服务器中安装 OCI8 扩展模块。
请点击此链接以获得简单的解决方案。
http://coffeewithcode。 com/2012/09/how-to-install-oracle-libraries-for-php5-on-ubuntu-server/
According to your problem. first thing is that linux doesn't support .dll file.
You have to install OCI8 extension module in your Apache server.
Follow this link to get easy solution.
http://coffeewithcode.com/2012/09/how-to-install-oracle-libraries-for-php5-on-ubuntu-server/
请检查是否有空格。
1. 将 php.ini 和 php_oci8.so 放在与要运行访问数据库的 php 程序相同的文件夹中。
2. php.ini 内容应如下所示:
Please check that there are no blank spaces.
1. put the php.ini and the php_oci8.so in the same folder as where you are going to run the php program that is going to access the database.
2. php.ini contents should look like: