我的MacBook版本是:Mac OS X Lion 10.7.5 (11G63b)
它自帶了PHP,版本為:5.3.15
PHP默認so包路徑:/usr/lib/php/extensions/no-debug-non-zts-20090626,下無所需的so包
因為OS已經自了PHP,只需更新即可,命令如下:
brew install https://raw.github.com/ampt/homebrew/php/Library/Formula/php.rb --with-apache --with-mssql
鬱悶的是,提示錯誤:
configure: error: Cannot find OpenSSL libraries
那就裝OpenSSL吧
其實我的Mac OS是自帶了的版本為:
$ openssl version
OpenSSL 0.9.8r 8 Feb 2011
估計是低了,那就下一個最新的版本裝上吧
openssl-1.0.1c.tar
$ tar -zxvf openssl-1.0.1c.tar
$ cd openssl-1.0.1c
$ ./Configure darwin64-x86_64-cc
又提示錯誤了:
sh: make: command not found
查了下,需要Xcode和它的Command Line Tool,好吧,再下載安裝
Xcode和Command Line Tool安裝完畢
重新執行 $ ./Configure darwin64-x86_64-cc
然後$ sudo make
然後$ sudo make install
顯示的東西有種黑客帝國的感覺 .。。。。。。
OpenSSL安裝完畢
$brew update
$sudo brew install https://raw.github.com/ampt/homebrew/php/Library/Formula/php.rb --with-apache --with-mssql
Shit 还是出错:
clang: clangerror: : linker command failed with exit code 1 (use -v to see invocation)
error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
make: *** [sapi/cgi/php-cgi] Error 1
那就換一種方式,下載PHP重新安裝配置
重新下了一個3.15不好使,換3.20
解压缩,进入解压缩后的文件夹下:php-5.3.20/ext/mssql/
$ phpize
$ sudo ./configure --with-php-config=/etc/php.ini
make
sudo make install
最後一條命令會將mssql.so安裝至/usr/lib/php/extensions/no-debug-non-zts-20090626/
修改php.ini 添加:
extension=mssql.so
$ php -v
PHP 5.3.15 with Suhosin-Patch (cli) (built: Jul 31 2012 14:49:18)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans
OK