系统版本: centos6
php版本:php-5.5.14
1 2 3 | [root@localhost ~]# cd php-5.5.14/ext/mssql [root@localhost mssql]# /usr/local/php/bin/phpize [root@localhost mssql]# ./configure --with-php-config=/usr/local/php/bin/php-config |
报错:
1 | configure: error: Cannot find FreeTDS in known installation directories |
FreeTDS是一个程序库,可以实现在Linux系统下访问微软的SQL数据库!
下载TDS:
1 2 3 | [root@localhost ~]# wget -c ftp://ftp.freetds.org/pub/freetds/stable/freetds-0.95.89.tar.gz [root@localhost freetds-0.95.89]# ./configure --prefix=/usr/local/freetds [root@localhost freetds-0.95.89]# make &&make install |
回到php扩展mssql目录:
1 2 3 | [root@localhost mssql]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-mssql=/usr/local/freetds/ [root@localhost mssql]# make && make install Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/ |
编辑php.ini载入模块
1 2 | extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/" extension = "mssql.so" |
重启服务。
通过phpinfo就可以看到mssql模块了。
原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/3557.html