个人安装php开发环境心得——nginx安装篇
2012-10-17 17:32
489 查看
个人安装php开发环境心得——nginx安装篇
1. 安装wget为了使用wget下载nginx 先安装wget,在configure时需要加上ssl参数,如下:
./configure --with-ssl=openssl
否则会报错,configure: error: –with-ssl was given, but GNUTLS is not available.
2. 下载nginxnginx最初下载的是1.2.4版。安装nginx前需要安装pcre,下载pcre 8.20,安装后开始./configure nginx, 在make阶段曝出如下错误:
3. 安装macports查找文档得知应该是安装pcre出错,官方文档建议:
Undefined symbols for architecture x86_64: "_pcre_free_study", referenced from: _ngx_pcre_free_studies in ngx_regex.o
在Nginx官方的问题列表里面有这个问题的具体描述,详细请看这里compilation fails on Mac OS X 10.7.2,其实就是库的位置没有找到。
1. Remove the PCRE version installed into /usr/local and reinstall one from macports. This is recommended solution.
2. Force /usr/local/lib to be before /usr/lib in library search path with ./configure --with-ld-opt="-I /usr/local/lib". This may work, but likely you'll be facing the same problem in other places as well.
具体过程首先安装macports,然后利用port安装pcre。安装macports可以编译源码,也可以直接使用dmg安装。Installing MacPorts上有详细的安装说明。安装pcre就很简单了,一行命令。
据此选用方案1, 下载macports,安装完成后,输入port install pcre,提示sudo:port:command not found,说明没有配置port的$PATH
在命令行下输入echo $PATH
显示:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
到Shell下查看~/.profile文件,会发现MacPorts在安装时已经把环境变量写入到该文件中了
在命令行下输入
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
或者将该profile导入/etc/profiles文件中,port命令即可使用
输入port install pcre
Error: Insufficient privileges to write to MacPorts install prefix.
说明没有root权限
sudo port install pcre即可
安装完成后试图编译nginx,仍然提示出错,去官网查询,显示地址:http://trac.nginx.org/nginx/ticket/161
Downloading 1.0.15 and building yields a successful install.
将ngix版本退回1.0.15 重新./configure make & make install 安装完成。
参考文档:
1. 张宴Nginx 0.8.x + PHP 5.2.13(FastCGI)搭建胜过Apache十倍的Web服务器(第6版)[原创] http://blog.s135.com/nginx_php_v6/
2. CSDN blog: amyangfei 在mac上安装nginx http://www.amyangfei.com/2012/05/01/install-nginx-for-mac/
3. Mac OSX Lion安装macports http://www.linuxidc.com/Linux/2012-01/52111.htm
1. 安装wget为了使用wget下载nginx 先安装wget,在configure时需要加上ssl参数,如下:
./configure --with-ssl=openssl
否则会报错,configure: error: –with-ssl was given, but GNUTLS is not available.
2. 下载nginxnginx最初下载的是1.2.4版。安装nginx前需要安装pcre,下载pcre 8.20,安装后开始./configure nginx, 在make阶段曝出如下错误:
objs/ngx_modules.o \ -lpcre -lssl -lcrypto -lz Undefined symbols for architecture x86_64: "_pcre_free_study", referenced from: _ngx_pcre_free_studies in ngx_regex.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status make[1]: * [objs/nginx] Error 1 make: * [build] Error 2
3. 安装macports查找文档得知应该是安装pcre出错,官方文档建议:
Undefined symbols for architecture x86_64: "_pcre_free_study", referenced from: _ngx_pcre_free_studies in ngx_regex.o
在Nginx官方的问题列表里面有这个问题的具体描述,详细请看这里compilation fails on Mac OS X 10.7.2,其实就是库的位置没有找到。
1. Remove the PCRE version installed into /usr/local and reinstall one from macports. This is recommended solution.
2. Force /usr/local/lib to be before /usr/lib in library search path with ./configure --with-ld-opt="-I /usr/local/lib". This may work, but likely you'll be facing the same problem in other places as well.
具体过程首先安装macports,然后利用port安装pcre。安装macports可以编译源码,也可以直接使用dmg安装。Installing MacPorts上有详细的安装说明。安装pcre就很简单了,一行命令。
据此选用方案1, 下载macports,安装完成后,输入port install pcre,提示sudo:port:command not found,说明没有配置port的$PATH
在命令行下输入echo $PATH
显示:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
到Shell下查看~/.profile文件,会发现MacPorts在安装时已经把环境变量写入到该文件中了
在命令行下输入
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
或者将该profile导入/etc/profiles文件中,port命令即可使用
输入port install pcre
Error: Insufficient privileges to write to MacPorts install prefix.
说明没有root权限
sudo port install pcre即可
安装完成后试图编译nginx,仍然提示出错,去官网查询,显示地址:http://trac.nginx.org/nginx/ticket/161
Downloading 1.0.15 and building yields a successful install.
将ngix版本退回1.0.15 重新./configure make & make install 安装完成。
参考文档:
1. 张宴Nginx 0.8.x + PHP 5.2.13(FastCGI)搭建胜过Apache十倍的Web服务器(第6版)[原创] http://blog.s135.com/nginx_php_v6/
2. CSDN blog: amyangfei 在mac上安装nginx http://www.amyangfei.com/2012/05/01/install-nginx-for-mac/
3. Mac OSX Lion安装macports http://www.linuxidc.com/Linux/2012-01/52111.htm
相关文章推荐
- Mac OS使用brew安装Nginx、MySQL、PHP-FPM的LAMP开发环境
- Mac OSX El Capitan 10.11 安装nginx(http2) php7.0 mysql5.7 开发环境
- 全新安装Mac OSX 开发者环境 同时使用homebrew搭建 PHP,Nginx ,MySQL,Redis,Memcache ... ... (LNMP开发环境)
- 最小化安装CentOS7 + xfce4 +PHP + nginx +mariadb 开发环境
- 全新安装Mac OSX 开发者环境 同时使用homebrew搭建 PHP,Nginx ,MySQL,Redis,Memcache ... ... (LNMP开发环境)
- 全新安装Mac OSX 开发者环境 同时使用homebrew搭建 PHP,Nginx ,MySQL,Redis,Memcache ... ... (LNMP开发环境)
- 在Mac OS上编译安装Nginx+PHP+MariaDB开发环境的教程
- 在Mac OS上编译安装Nginx+PHP+MariaDB开发环境的教程
- Mac下一键安装Apache/Nginx+MySQL+PHP开发环境 及各版本测试PHP探针
- Mac OS使用brew安装Nginx、MySQL、PHP-FPM的LAMP开发环境
- Mac下安装 php+nginx+mysql 开发环境
- 全新安装Mac OSX 开发者环境 同时使用homebrew搭建 PHP,Nginx ,MySQL,Redis,Memcache ... ... (LNMP开发环境)
- 全新安装Mac OSX 开发者环境 同时使用homebrew搭建 PHP,Nginx ,MySQL,Redis,Memcache ... ... (LNMP开发环境)
- Mac OS使用brew安装Nginx、MySQL、PHP-FPM的LAMP开发环境
- 全新安装Mac OSX 开发者环境 同时使用homebrew搭建 PHP,Nginx ,MySQL,Redis,Memcache ... ... (LNMP开发环境)
- Linux 环境下安装 Nginx+php+mysql 开发环境
- 全新安装Mac OSX 开发者环境 同时使用homebrew搭建 PHP,Nginx ,MySQL,Redis,Memcache ... ... (LNMP开发环境)
- 全新安装Mac OSX 开发者环境 同时使用homebrew搭建 PHP,Nginx ,MySQL,Redis,Memcache ... ... (LNMP开发环境)
- Linux下从零开始安装配置Nginx服务器+PHP开发环境