(转+原)nignx php5.5.14 安装配置
2014-07-16 14:43
337 查看
下载 PHP 源码包
# wget http://cn2.php.net/distributions/php-5.5.14.tar.bz2 # tar xf php-5.5.14.tar.bz2
添加 epel 源
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm[/code]
安装依赖# yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel
创建 apache 用户groupadd apache useradd -g apache apache# cd /usr/local/php-5.5.14/# ./configure\ --prefix=/usr/local/php \ --with-config-file-path=/etc \ --enable-inline-optimization \ --disable-debug \ --disable-rpath \ --enable-shared \ --enable-opcache \ --enable-fpm \ --with-fpm-user=apache \ --with-fpm-group=apache \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-gettext \ --enable-mbstring \ --with-iconv \ --with-mcrypt \ --with-mhash \ --with-openssl \ --enable-bcmath \ --enable-soap \ --with-libxml-dir \ --enable-pcntl \ --enable-shmop \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-sockets \ --with-curl \ --with-zlib \ --enable-zip \ --with-bz2 \ --with-readline \ --without-sqlite3 \ --without-pdo-sqlite \ --with-pear
[/code]
参数说明:""" 安装路径 """ --prefix=/usr/local/php \ """ php.ini 配置文件路径 """ --with-config-file-path=/etc \ """ 优化选项 """ --enable-inline-optimization \ --disable-debug \ --disable-rpath \ --enable-shared \ """ 启用 opcache,默认为 ZendOptimizer+(ZendOpcache) """ --enable-opcache \ """ FPM """ --enable-fpm \ --with-fpm-user=apache\ --with-fpm-group=apache \ """ MySQL """ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ """ 国际化与字符编码支持 """ --with-gettext \ --enable-mbstring \ --with-iconv \ """ 加密扩展 """ --with-mcrypt \ --with-mhash \ --with-openssl \ """ 数学扩展 """ --enable-bcmath \ """ Web 服务,soap 依赖 libxml """ --enable-soap \ --with-libxml-dir \ """ 进程,信号及内存 """ --enable-pcntl \ --enable-shmop \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ """ socket & curl """ --enable-sockets \ --with-curl \ """ 压缩与归档 """ --with-zlib \ --enable-zip \ --with-bz2 \ """ GNU Readline 命令行快捷键绑定 """ --with-readline \ """ 禁用 SQLite 支持扩展 """ --without-sqlite3 \ --without-pdo-sqlite \ """ 更多 PHP 扩展与应用库 """ --with-pear配置文件:
配置 PHP# cp php.ini-development /etc/php.ini
php-fpm 服务# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf # cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm # chmod +x /etc/init.d/php-fpm
启动 php-fpm# service php-fpm start Starting php-fpm done
php-fpm 可用参数 start|stop|force-quit|restart|reload|status编辑
添加 PHP 命令到环境变量~/.bash_profile,将:PATH=$PATH:$HOME/bin 改为: PATH=$PATH:$HOME/bin:/usr/local/php/bin
使 PHP 环境变量生效:# . ~/.bash_profile查看php版本:
php –version
PHP 5.5.14 (cli) (built: Jul 15 2014 19:42:48) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologie
如果版本不对,说明有老版本没有卸载完成,可以找到旧的安装文件做卸载操作,如果不行,则可以找出相关的php目录删除即可。Nginx 安装:下载:http://wiki.nginx.org/Install选择最新或稳定版本解压:tar xf nginx-1.7.3.tar.gz安装:cd nginx-1.7.3./configure--prefix=/usr/local/nginx[/code]make && make installcp /usr/local/nginx/sbin/nginx /etc/init.d/nginx配置nginx:cd /usr/local/nginx/confvim nginx.conf把#user nobody修改:user apache apache #根据喜好配置修改:location / {root html;#可以改成自己的web服务器根目录,同时目录用户修改为apacheindex index.php index.html}修改:locate ~ \.php$ {include fastcgi.conf;#也可以把fastcgi的配置往这里写,参考默认选项}修改fastcgi.confvim fastcgi.conf在开头增加:fastcgi_pass 127.0.0.1:9000;#这里的id和端口一定要和php-fpm一致 fastcgi_index index.php;新建测试php文件:cd /usr/local/nginx/html/vim index.php修改访问目录所属用户:chown -R apache:apache html启动nginx:service nginx start在浏览器ip访问看到nginx欢迎页面说明nginx安装成功ip/index.php 看到php的输出结果则说明php fastcgi 配置成功
相关文章推荐
- php安装配置
- Win2003下APACHE+PHP5+MYSQL4+PHPMYADMIN 的简易安装配置
- 教程-Win2003下APACHE+PHP5+MYSQL4+PHPMYADMIN 的简易安装配置
- Apache、php、mysql在windows下的安装与配置图解(最新版)
- apache+php5+mysql4(5)+phpmyadmin 的简易安装配置
- Apache+Mod_perl+Mod_SSL+PHP+Frontpage extension+Apache::ASP 安装配置手册
- Apache+PHP5+MySQL4(5)+PHPMyAdmin 的简易安装配置
- 用iis配置php,安装一步到位!
- 用iis配置php,安装一步到位!
- PHP的安装与配置
- Windows下PHP和Apache的安装与配置
- PHP、Apache的安装和配置
- PHP 5 在 Windows下 的 APACHE 模块化安装 和 MySQL 配置
- Win2003下APACHE+PHP5+MYSQL4+PHPMYADMIN 的简易安装配置
- php安装配置
- RedHat Linux下tomcat5.0.28 +apache2.0.50+php4.3.9安装配置[原]
- Win2003下APACHE+PHP5+MYSQL4+PHPMYADMIN 的简易安装配置
- linux 学习笔记 - php 环境安装与配置
- Apache+php+mysql在windows下的安装与配置图解(最新版)
- [PHP]APACHE模块化安装PHP以及MySQL 配置@Windows(PHP5)