1. 下载nginx
http://nginx.org/en/download.html
下载版本1.2.7
2. 编译安装nginx,先现在zlib和pcre
http://nginx.org/en/docs/install.html
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=../pcre-4.4 --with-zlib=../zlib-1.1.33. 下载php和mysql
http://www.php.net/downloads.php
http://www.mysql.com/downloads/mysql/
4. 先安装mysql(选择)
为了在编译php时,先把mysql编译进去,省的以后为扩展编译mysql
5. 在/etc/profile中加入如下环境变量
#vi /etc/profile
export PATH=/usr/local/mysql/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib
6. 安装php
./configure --prefix=/usr/local/php \
--with-mysql=/usr/local/mysql \#设置mysql的安装路径
--enable-fastcgi \ #开启fastcgi支持
--enable-debug #支持调试
1)make出错,提示:Undefined symbols: "_res_9_dn_expand", referenced from: _zif_dns_get_mx in dns.o "_res_9_search", referenced from: _zif_dns_get_mx in dns.o _zif_dns_check_record in dns.o "_res_9_dn_skipname", referenced from: _zif_dns_get_mx in dns.o _zif_dns_get_mx in dns.o ld: symbol(s) not found解决办法:
在Makefile中EXTRA_LIBS最后加入 -lresolv
2)make提示缺少 Library not loaded: libmysqlclient.18.dylib
可以采用sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib