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.3
3. 下载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
本文档详细介绍了在Mac OS操作系统上编译安装Nginx和PHP的步骤,包括下载Nginx的1.2.7版本,安装依赖zlib和pcre,以及编译时集成MySQL。此外,还提到了设置环境变量和解决PHP编译时的库文件问题。
534

被折叠的 条评论
为什么被折叠?



