[英]PHP Warning: PHP Startup: Unable to load dynamic library 'php_ibm_db2.dll'
I want to install the db2 extension for PHP on Windows but it just isn't working.我想在 Windows 上安装 PHP 的 db2 扩展,但它就是不工作。 I've tried a lot of different solutions but I still get these:我尝试了很多不同的解决方案,但我仍然得到这些:
When I try connection to db2 database当我尝试连接到 db2 数据库时
I'm using Apache on XAMPP on port 80. I have installed this: https://github.com/ibmdb/php_ibm_db2/tree/master/PHP%207.4.x/x64/TS and placed it in my C:\xampp\php\ext folder and set "extension=php_ibm_db2.dll" in my php.ini file. I'm using Apache on XAMPP on port 80. I have installed this: https://github.com/ibmdb/php_ibm_db2/tree/master/PHP%207.4.x/x64/TS and placed it in my C:\xampp \php\ext 文件夹并在我的 php.ini 文件中设置“extension=php_ibm_db2.dll”。 (which is in C:\xampp\php) (在 C:\xampp\php 中)
Only "db2" appearing in phpinfo()只有“db2”出现在 phpinfo()
So, I did not manage to connect to my db2 DB with the db2 extension, but here's an alternative I've found -->所以,我没有设法使用 db2 扩展名连接到我的 db2 DB,但这是我找到的替代方案 -->
$database = "xxx";
$hostname = "xxx";
$user = "xxx";
$password = "xxx";
$port = 50000;
# Build the connection string
$driver = "DRIVER={IBM DB2 ODBC DRIVER};";
$dsn = "DATABASE=$database; " .
"HOSTNAME=$hostname;" .
"PORT=$port; " .
"PROTOCOL=TCPIP; " .
"UID=$user;" .
"PWD=$password;";
$conn_string = $driver . $dsn;
# Connect
$conn = odbc_connect( $conn_string, "", "" );
if( $conn )
{
echo "Connection succeeded.";
odbc_close( $conn );
}
else
{
echo "Connection failed.";
}
output --> Connection succeeded. output --> 连接成功。
source --> https://www.ibm.com/docs/en/db2woc?topic=programmatically-php来源 --> https://www.ibm.com/docs/en/db2woc?topic=programmatically-php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.