dqvzfp6468
2018-10-22 13:49
浏览 89

为什么PHP看不到扩展dll文件?

I am little bit confused with strange behavior of PHP and need advice how to fix it.

I am tring to test pretty simple php script:

$conn = oci_connect($dbUser, $dbPassword, $dbServerName . "/" . $dbName);
if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message']), E_USER_ERROR);
}

Unfortunatly it raise me next ERROR:

[22-Oct-2018 19:22:23] PHP Warning:  PHP Startup: Unable to load dynamic library 'F:\PHP_x64\ext\php_oci8_12c.dll' - The specified procedure could not be found.
 in Unknown on line 0
[22-Oct-2018 19:22:23] PHP Fatal error:  Call to undefined function oci_connect() in F:\TEST\complain\test.php on line 8

I have project which is located in IIS web server. Project use PHP Version 5.6.28.

enter image description here

Inside F:\PHP_x64\ext\ folder I have file php_oci8_12c.dll as you can see below: enter image description here

Inside php.ini file I have uncommented line:

extension=php_oci8_12c.dll

Also in php.ini file I add:

extension_dir = "F:\PHP_x64\ext\"
[PHP_OCI8_12C]
extension=php_oci8_12c.dll

I restart IIS web server several times.

When I try to call php.exe from console it show me next error:

enter image description here

图片转代码服务由CSDN问答提供 功能建议

我对PHP的奇怪行为感到困惑,需要建议如何修复它。

我想测试非常简单的php脚本:

  $ conn = oci_connect($ dbUser,$ dbPassword,$ dbServerName。“/”。$ dbName)  ; 
if(!$ conn){
 $ e = oci_error(); 
 trigger_error(htmlentities($ e ['message']),E_USER_ERROR); 
} 
   \  n 
 

不幸的是,它让我接下来 ERROR

  [22-Oct-2018 19:22:23] PHP警告:PHP 启动:无法加载动态库'F:\ PHP_x64 \ ext \ php_oci8_12c.dll' - 无法找到指定的过程。
在第0行的未知
 [22-Oct-2018 19:22:23] PHP 致命错误:在第8行的F:\ TEST \ _protein \ test.php中调用未定义的函数oci_connect()
   
 
 

我有一个位于IIS web中的项目 服务器。 项目使用PHP版本5.6.28。

内部 F:\ PHP_x64 \ ext \ 文件夹我有文件 php_oci8_12c.dll ,如下所示: < p>在 php.ini 文件中我有一条未注释的行:

  extension = php_oci8_12c.dll 
   
  
 

同样在 php.ini 文件中我添加:

  extension_dir =“F:\ PHP_x64 \ ext \”
 [PHP_OCI8_12C  ] 
extension = php_oci8_12c.dll 
   
 
 

我多次重启IIS Web服务器。

当我尝试调用php时。 来自控制台的exe它向我显示下一个错误:

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doujie4787 2018-10-25 07:27
    已采纳

    Finally I found solution which work for me.

    The code which I use to connect PHP with Oracle:

    $conn = oci_connect($dbUser, $dbPassword, "(DESCRIPTION=(ADDRESS_LIST =(ADDRESS=(PROTOCOL = TCP)(HOST=$dbServerName)(PORT = 1521)))(CONNECT_DATA=(SID=$dbSID)))", 'AL32UTF8') or die("Could not connect to ORACLE");
    

    In my case I used SID, you can also use SERVICE_NAME.

    点赞 打赏 评论

相关推荐 更多相似问题