参照这篇国外的文章:http://blog.benjaminwalters.net/?p=10
虽然他是为mamp安装mssql扩展,但是我们也可以参考他其中的这一步骤:
Compile PHP
- Download and untar/zip the latest source (http://php.net/downloads.php)
- Cd into the php directory in terminal
- i/e cd ~/Downloads/php-5.3.6
- Configure PHP
- Type “./configure” and press enter
- Type “make” and press enter
- Go into the mssql extension directory
- i/e cd ~/Downloads/php-5.3.6/ext/mssql
- phpize it! (type phpize)
- Configure mssql to run with freetds
- Type
./configure --with-mssql=/usr/local/freetds
and press enter
- Type
- Type “make” and press enter
- Open finder and go to the mssql module directory (~/Downloads/php-5.3.6/ext/mssql/modules/)
- Copy mssql.so to the extension directory of your php installation
- MAMP on my machine is located here /Applications/MAMP/bin/php/php-5.3.6/lib/php/extensions/no-debug-non-zts-20090626/
- Paste the mssql.so into this folder (there should be a bunch of other .so files)
- Go up a few directories to /Applications/MAMP/bin/php/php-5.3.6/conf/php.ini and open it.
- Search for “extension=”
- Paste “extension=mssql.so” on the line below the other extensions
- Restart MAMP!
Test it!!!!!
我自己的php版本是5.4.24 ,我想去php.net下载相应版本没找到,所以下载了php5.4.30,最后验证也是有效的,大家可以下载跟自己php相应的版本。
最后按照步骤安装,之后:
最后就成功啦~~~
mssql
MSSQL Support | enabled |
---|---|
Active Persistent Links | 0 |
Active Links | 0 |
Library version | FreeTDS |
Directive | Local Value | Master Value |
---|---|---|
mssql.allow_persistent | On | On |
mssql.batchsize | 0 | 0 |
mssql.charset | no value | no value |
mssql.compatability_mode | Off | Off |
mssql.connect_timeout | 5 | 5 |
mssql.datetimeconvert | On | On |
mssql.max_links | Unlimited | Unlimited |
mssql.max_persistent | Unlimited | Unlimited |
mssql.max_procs | Unlimited | Unlimited |
mssql.min_error_severity | 10 | 10 |
mssql.min_message_severity | 10 | 10 |
mssql.secure_connection | Off | Off |
mssql.textlimit | Server default | Server default |
mssql.textsize | Server default | Server default |
mssql.timeout | 60 | 60 |