简体   繁体   English

Zend不会加载pdo_dblib

[英]Zend doesn't load pdo_dblib

I'm trying to connect a Zend application (version 1.11.11) to an mssql server via pdo_dblib (using PHP version 7.0.22). 我正在尝试通过pdo_dblib(使用PHP版本7.0.22)将Zend应用程序(版本1.11.11)连接到mssql服务器。 I know that my PHP installation has pdo_dblib since running print(extension_loaded('pdo_dblib')); 我知道自从运行print(extension_loaded('pdo_dblib'));我的PHP安装中就有pdo_dblib print(extension_loaded('pdo_dblib')); in the terminal returns 1 . 在终端返回1 In the .ini file I have: 在.ini文件中,我有:

resources.db.adapter = "pdo_mssql"
resources.db.params.pdoType = "pdo_dblib"

When I run the application with a debugger, the value of the statement $a = extension_loaded('pdo_dblib'); 当我使用调试器运行应用程序时,语句$a = extension_loaded('pdo_dblib'); is false . false

As a result of this PDO::getAvailableDrivers() doesn't contain pdo_dblib (of course), which causes the application to throw an exception. 由于此PDO::getAvailableDrivers()不包含pdo_dblib(当然),因此会导致应用程序引发异常。

Does anyone know why this problem occurs, and how to fix it? 有谁知道为什么会出现此问题,以及如何解决它?

The key is not Zend, but in a subtle detail of your tests: 关键不是Zend,而是测试的微妙细节:

  • running print(extension_loaded('pdo_dblib')); 运行print(extension_loaded('pdo_dblib')); in the terminal returns 1 在终端返回1
  • when I run the application with a debugger, the value of the statement $a = extension_loaded('pdo_dblib'); 当我使用调试器运行应用程序时,语句$a = extension_loaded('pdo_dblib'); is false false

PHP on the terminal is not guaranteed to have the same configuration, or even be the same version, as PHP on the web server of the same machine. 不能保证终端上的PHP与同一台计算机的Web服务器上的PHP具有相同的配置,甚至是相同的版本。

You will need to look into your hosting setup to find out how to enable the extension in the php.ini (or equivalent) in the web server's copy of PHP. 您将需要研究主机设置,以了解如何在Web服务器的PHP副本的php.ini (或等效文件)中启用扩展。 The output of phpinfo() run in your application, not the terminal , may help. phpinfo()的输出在您的应用程序中运行,而不是在终端中运行 ,可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM