centos 6.x 上的 pdo dblib

2023-12-05

我正在尝试在 CentOS 版本 6.5(最终版)64 位上安装 dblib。 centos 6 没有 freetds,所以我必须从其他地方获取 freetds。freetds-devel-0.91-2.1.x86_64.rpm。使用 pecl 下载并安装 PDO DBLIB 但我陷入 make 困境。我收到的错误如下。

[root@rajesh PDO_DBLIB-1.0]# make
/bin/sh /root/php/PDO_DBLIB-1.0/libtool --mode=compile cc -I/usr/include/php/ext -DPDO_DBLIB_FLAVOUR=\"freetds\" -I. -I/root/php/PDO_DBLIB-1.0 -DPHP_ATOM_INC -I/root/php/PDO_DBLIB-1.0/include -I/root/php/PDO_DBLIB-1.0/main -I/root/php/PDO_DBLIB-1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/php/PDO_DBLIB-1.0/pdo_dblib.c -o pdo_dblib.lo 
libtool: compile:  cc -I/usr/include/php/ext -DPDO_DBLIB_FLAVOUR=\"freetds\" -I. -I/root/php/PDO_DBLIB-1.0 -DPHP_ATOM_INC -I/root/php/PDO_DBLIB-1.0/include -I/root/php/PDO_DBLIB-1.0/main -I/root/php/PDO_DBLIB-1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/php/PDO_DBLIB-1.0/pdo_dblib.c  -fPIC -DPIC -o .libs/pdo_dblib.o
In file included from /root/php/PDO_DBLIB-1.0/pdo_dblib.c:32:
/root/php/PDO_DBLIB-1.0/php_pdo_dblib_int.h:45:23: error: sybfront.h: No such file or directory
/root/php/PDO_DBLIB-1.0/php_pdo_dblib_int.h:46:20: error: sybdb.h: No such file or directory
/root/php/PDO_DBLIB-1.0/php_pdo_dblib_int.h:47:23: error: syberror.h: No such file or directory
In file included from /root/php/PDO_DBLIB-1.0/pdo_dblib.c:32:
/root/php/PDO_DBLIB-1.0/php_pdo_dblib_int.h:90: error: expected ‘)’ before ‘*’ token
/root/php/PDO_DBLIB-1.0/php_pdo_dblib_int.h:93: error: expected ‘)’ before ‘*’ token
/root/php/PDO_DBLIB-1.0/php_pdo_dblib_int.h:110: error: expected specifier-qualifier-list before ‘LOGINREC’
/root/php/PDO_DBLIB-1.0/pdo_dblib.c:76: error: expected ‘)’ before ‘*’ token
/root/php/PDO_DBLIB-1.0/pdo_dblib.c:123: error: expected ‘)’ before ‘*’ token
/root/php/PDO_DBLIB-1.0/pdo_dblib.c: In function ‘zm_startup_pdo_dblib’:
/root/php/PDO_DBLIB-1.0/pdo_dblib.c:175: error: ‘FAIL’ undeclared (first use in this function)
/root/php/PDO_DBLIB-1.0/pdo_dblib.c:175: error: (Each undeclared identifier is reported only once
/root/php/PDO_DBLIB-1.0/pdo_dblib.c:175: error: for each function it appears in.)
/root/php/PDO_DBLIB-1.0/pdo_dblib.c:195: error: ‘error_handler’ undeclared (first use in this function)
/root/php/PDO_DBLIB-1.0/pdo_dblib.c:196: error: ‘msg_handler’ undeclared (first use in this function)
make: *** [pdo_dblib.lo] Error 1


[root@rajesh php]# whereis freetds
freetds: /etc/freetds.conf /usr/include/freetds /usr/local/freetds


[root@rajesh php]# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_dblib.so' - /usr/lib64/php/modules/pdo_dblib.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.3.3 (cli) (built: Dec 11 2013 03:29:57) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

[root@rajesh ~]# rpm -qa | grep freetds
freetds-devel-0.91-1.el6.rf.x86_64
freetds-0.91-1.el6.rf.x86_64

我曾尝试改变function_entry to zend_function_entry in pdo_dblib.c但并不像中提到的那样工作http://www.radebatz.net/mano/2013/11/05/compiling-pdo_dblib-on-centos-6-with-php-5-4/.

我也尝试过

[root@rajesh PDO_DBLIB-1.0]# ll /usr/include/freetds
total 132
-rw-r--r-- 1 root root  3054 Feb 19  2013 bkpublic.h
-rw-r--r-- 1 root root 21930 Feb 19  2013 cspublic.h
-rw-r--r-- 1 root root  4847 Feb 19  2013 cstypes.h
-rw-r--r-- 1 root root  7319 Feb 19  2013 ctpublic.h
-rw-r--r-- 1 root root   995 Feb 19  2013 odbcss.h
-rw-r--r-- 1 root root  5086 Feb 19  2013 sqldb.h
-rw-r--r-- 1 root root  1985 Feb 19  2013 sqlfront.h
-rw-r--r-- 1 root root 60728 Feb 19  2013 sybdb.h
-rw-r--r-- 1 root root  1535 Feb 19  2013 syberror.h
-rw-r--r-- 1 root root  1235 Feb 19  2013 sybfront.h
-rw-r--r-- 1 root root  2686 Feb 19  2013 tds_sysdep_public.h
[root@rajesh PDO_DBLIB-1.0]# cp /usr/include/freetds/* /usr/local/freetds/include/
cp: overwrite `/usr/local/freetds/include/bkpublic.h'? n
cp: overwrite `/usr/local/freetds/include/cspublic.h'? n
cp: overwrite `/usr/local/freetds/include/cstypes.h'? n
cp: overwrite `/usr/local/freetds/include/ctpublic.h'? n
cp: overwrite `/usr/local/freetds/include/odbcss.h'? n
cp: overwrite `/usr/local/freetds/include/sqldb.h'? n
cp: overwrite `/usr/local/freetds/include/sqlfront.h'? n
cp: overwrite `/usr/local/freetds/include/sybdb.h'? n
cp: overwrite `/usr/local/freetds/include/syberror.h'? n
cp: overwrite `/usr/local/freetds/include/sybfront.h'? n
cp: overwrite `/usr/local/freetds/include/tds_sysdep_public.h'? n

似乎它没有获取包含目录。

我已成功使用以下配置命令安装 PDO DBLIB./configure --prefix=/usr/local/freetds --with-gnu-ld --with-pdo-dblib=/usr/local/freetds。在我的网络应用程序上,我不断收到。CDbConnection failed to open the DB connection: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)

/etc/freetds.conf

[ebenezer]
        host = ebenezer.uk.domain.com
        port = 1433
        tds version = 8.0


[root@rajesh PDO_DBLIB-1.0]# tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /etc
     MS db-lib source compatibility: yes
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: no


[root@rajesh PDO_DBLIB-1.0]# TDSVER=8.0 tsql -S ebenezer -U invload -P invload
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> quit

清理后我设法以某种方式回到

[root@rajesh freetds-0.91]# TDSVER=7.1 /usr/local/freetds/bin/tsql -H ebenezer -U invload -P invlaod -p 1443
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20009 (severity 9):
    Unable to connect: Adaptive Server is unavailable or does not exist
    OS error 111, "Connection refused"
There was a problem connecting to the server
[root@rajesh freetds-0.91]# /usr/bin/ts
tset   tsort  tsql   
[root@rajesh freetds-0.91]# /usr/bin/ts
tset   tsort  tsql   
[root@rajesh freetds-0.91]# /usr/bin/tsql -H ebenezer -U invload -P invlaod -p 1443
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20009 (severity 9):
    Unable to connect: Adaptive Server is unavailable or does not exist
    OS error 111, "Connection refused"
There was a problem connecting to the server


tail: /tmp/freetds.log: file truncated
log.c:196:Starting log file for FreeTDS 0.91
    on 2014-01-24 20:07:55 with debug flags 0x4fff.
iconv.c:330:tds_iconv_open(0x142c3e0, UTF-8)
iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
iconv.c:187:local name for UTF-8 is UTF-8
iconv.c:187:local name for UCS-2LE is UCS-2LE
iconv.c:187:local name for UCS-2BE is UCS-2BE
iconv.c:349:setting up conversions for client charset "UTF-8"
iconv.c:351:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:391:preparing iconv for "ISO-8859-1" <-> "ISO-8859-1" conversion
iconv.c:394:tds_iconv_open: done
net.c:205:Connecting to 172.16.0.71 port 1443 (TDS version 4.2)
net.c:270:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:306:getsockopt(2) reported: Connection refused
net.c:316:tds_open_socket() failed
util.c:331:tdserror(0x142c140, 0x142c3e0, 20009, 111)
util.c:361:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:384:tdserror: returning TDS_INT_CANCEL(2)
mem.c:615:tds_free_all_results()

实现这一目标的简单方法是:

  1. 启用 EPEL 存储库
  2. Install php-mssql。这将安装unixODBC and freetds, too.

# yum 安装 php-mssql

然后,您可以从 CentOS 从 PHP + PDO(使用 dblib 驱动程序)连接到 MSSQL 服务器

$dsn = "dblib:host=<host>;dbname=<dbname>";
$user = <user>;
$password = <password>;
$db = new PDO($dsn, $user, $password);

Dockerfile 示例,但也应该适用于任何 CentOS6+ 和 PHP 7.0:

FROM centos:centos7

RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm\
# We include PHP 7 from REMI since it's not in EPEL.
    http://rpms.remirepo.net/enterprise/remi-release-7.rpm\
# This will help verify packages and so you will see fewer errors(red) in the build output.
 && rpm --import \
      /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7\
      /etc/pki/rpm-gpg/RPM-GPG-KEY-remi\
      /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7\
# Spedify which version of PHP 7 to install here
 && yum-config-manager --enable remi,remi-php70\
 && yum -y install php-mssql
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

centos 6.x 上的 pdo dblib 的相关文章

  • ZF3/2 - 如何捕获 EVENT_DISPATCH 侦听器中引发的异常?

    有什么方法可以在 EVENT DISPATCH 监听器中抛出异常吗 class Module public function onBootstrap EventInterface event application event gt get
  • 如何使用 php 将 *.xlsb 转换为数组或 *.csv

    我正在尝试转换 xlsb文件到php array or csv文件 或至少 xls 我尝试使用PHPExcel 但看起来它无法识别该文件中的内容 我注意到 你可以重命名 xlsb文件到 zip文件 然后使用命令行解压缩unzip zip 之
  • ZipArchive 提取 - 单个文件

    我有以下代码 ipaFile path file ipa iconFilePath Payload myapp app email protected cdn cgi l email protection the pathway to my
  • C++ 相当于 PHP 的 pack()

    我的问题很简单 有没有类似 PHP 的pack and unpack C STL 中的函数 如果没有 是否有其他方法可以实现相同的目标 https www php net pack https www php net pack Thanks
  • PHP cURL 重定向到本地主机

    我正在尝试使用带有 cURL 的 php 脚本登录外部网页 我是 cURL 的新手 所以我觉得我错过了很多东西 我找到了几个例子并修改了它们以允许访问https页面 最终 我的目标是能够登录页面并在登录后通过指定的链接下载 csv 到目前为
  • 如何在 Laravel 5 中对合并集合进行分页?

    我正在创建一个包含两种类型的对象的流 BluePerson 和 RedPerson 为了创建流 我获取所有这两个对象 然后将它们合并到一个集合中 这样做之后 我需要对它们进行分页 但是分页似乎是针对雄辩的模型和数据库查询 而不是集合 我见过
  • 重定向而不是 404 错误页面 - 状态代码不起作用 (Nginx)

    我目前正在迁移到 nginx 服务器 我尝试将其放入名为的 404 ErrorDocument 中404 php 如果我现在尝试访问http mydomain com 404 php 这按预期工作 它将我重定向到 Google 但是一旦我尝
  • TCPDF / FPDI 可以接受 PDF 作为字符串吗?

    是否可以将 TCPDF 或 FPDI PDF 作为字符串提供 我有一个传入的 PDF 数组作为字符串 但无法写入磁盘 我在文档中找不到与此相关的任何内容 如果没有 是否有一种有效的方法来从内存或作为对象存储 读取这些 PDF 将它们喂给 F
  • 从目录中读取所有文件内容 - php

    这实际上是一个简单的任务 我想显示指定文件夹中所有文件的内容 我正在传递目录名称 echo a href row qname a 在第二页上 我正在迭代目录内容 while entryname readdir myDirectory if
  • php递归合并

    我需要以某种不同的方式合并一些数组 我使用 array merge recursive 然而 有一些事情我需要改变 但我不知道如何改变 这是来自 php net 的引用 但是 如果数组具有相同的数字键 则后面的值 不会覆盖原始值 但会追加
  • php exec 返回的结果比直接进入命令行要少

    我有一个 exec 命令 它的行为与通过 Penguinet 给 linux 的相同命令不同 res exec cd mnt mydirectory zcat log file gz echo res 当将命令直接放入命令行时 我在日志文件
  • 维护 HttpUrlConnection 调用之间的会话(Native/Webview)

    让我从我做的开始desire 我想制作一个应用程序part native and part webviews Problem 维护本机和 webview 部分之间的会话 My 处理方法 this 我打算实现一个本机登录 其中我向用户展示两个
  • 根据类别 woocommerce 更改同一产品的默认变体值

    我正在研究一种根据其所属类别显示同一产品的默认变体值的方法 例如 我出售一张带有蓝色和红色选项的卡 当用户进入 一 类别时 我希望默认值为蓝色 如果他属于第二类 则该值将为红色 我发现了一个钩子woocommerce product def
  • 如何使用php在mysql数据库中添加照片? [关闭]

    这个问题不太可能对任何未来的访客有帮助 它只与一个较小的地理区域 一个特定的时间点或一个非常狭窄的情况相关 通常不适用于全世界的互联网受众 为了帮助使这个问题更广泛地适用 访问帮助中心 help reopen questions 我对 PH
  • Laravel 上传前如何压缩图像?

    我正在制作一个图片库网站 用户可以在其中上传任何图像 它们将显示在前端 我需要在不影响图像质量的情况下压缩图像 以减小图像大小 以便页面加载速度不会影响那么大 我使用以下代码来上传图像 rules array file gt require
  • PHP函数返回值到html标签

    我想获取函数的返回值并将其显示到特定的id 在我的 Class php 中 我有一个名为 login 的函数 用于验证密码是否正确 不正确
  • PHP多图像文件上传并存储到文件夹和数据库

    我正在建立一个网站 向夜间狂欢者展示大城市夜总会场所和活动的列表 我正在尝试构建一个后端页面 管理员可以在其中添加俱乐部并输入信息 例如机构名称 位置 相对价格等 当然还有俱乐部的一些图像 每个俱乐部必须至少有一张图像 即主图像 可以有额外
  • 我应该使用排队系统来处理付款吗?

    我在用着Slim https www slimframework com和这个结合Stripe 的 PHP 库 https stripe com docs api php在我的应用程序中处理付款 一切都很好 但是直到最近 我在我的系统中发现
  • phpstorm xdebug 与 symfony2 项目

    我正在尝试使用 xdebug 和 phpstorm 调试 symfony2 应用程序 我的本地开发环境是Ubuntu 14 04 with apache2 Xdebug版本是2 2 7 我在另一个 php 不是 symfony2 项目上使用
  • PHP 中的坏词过滤器?

    我正在用 PHP 编写一个坏词过滤器 我在数组中有一个坏词列表 方法 clean text 的写法如下 public static function cleanse text originalstring if self is sorted

随机推荐