PHP 連接 MSSQL

    版本為 14:35, 26 Dec 2024

    到這個版本。

    返回到 版本存檔.

    查閱目前版本

    系統環境:

    • CentOS 5.5
    • PHP 5.3
    • MS SQL
       

    Microsoft SQL Server and Sybase Functions (PDO_DBLIB)

    以 tar file 安裝)
    http://www.phpv.net/html/1586.html

    以 RPM 方式安裝)
    http://www.howtoforge.com/installing...ssql_centos5.0

    步驟開始

    相依性套件安裝
    yum install php-devel freetds-devel
    重編 SRPM 套件

    // 下載 SRPM:http://ftp.isu.edu.tw/pub/Linux/CentOS/5.5/os/SRPMS/

    cd /usr/src/redhat/SRPMS
    wget http://ftp.isu.edu.tw/pub/Linux/CentOS/5.5/os/SRPMS/php-5.1.6-27.el5.src.rpm 
    rpm -ivh php-5.1.6-27.el5.src.rpm
    vi ../SPECS/php.spec
    

    php.spec:
    在最後一個 %package...%description 加上

    %package mssql
    Group: Development/Languages
    Requires: php = %{version}-%{release}, php-pdo
    Summary: A module for PHP applications that use the MSSQL database.
    provides: php_database
    BuildRequires: freetds-devel
    
    %description mssql
    The MSSQL package contains a dynamic shared object that will add support for accessing MSSQL databases to php.

    找到這幾行,在 CFLAGS 這行刪除 -Wno-pointer-sign 。

    # Regenerate configure scripts (patches change config.m4's)
    ./buildconf --force
    
    CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
    CPPFLAGS="-DLDAP_DEPRECATED=1"
    export CFLAGS CPPFLAGS
    
    # Install extension modules in %{_libdir}/php/modules.
    EXTENSION_DIR=%{_libdir}/php/modules; export EXTENSION_DIR
    

    重新編譯套件

    rpmbuild -bb ../SPECS/php.spec
    
    Powered by MindTouch Core