mac os上編譯安裝nginx php

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  


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章