nginx安装php和php-fpm
最近在学习nginx,看了好多帖子终于安装成功了。
经验,首先不要用yum安装,安装完以后根本找不到安装目录在哪里呀,然后安装失败以后会很不方便。
最终选择了自己编译安装。
看了好多帖子都不行,终于找到一个靠谱的呀,好详细。帖子地址http://www.cnblogs.com/zxpo/p/3798983.html
php-fpm打补丁
cd /usr/local/src
gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1
下面是粘贴过来的帖子内容;
1、下载php源码包
http://www.php.net/downloads.php
2 、安装php
tar -xvf php-5.5.13.tar.bz2
cd php-5.5.13
./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=www --with-fpm-group=www --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
出现错误: congigure error: xml2-config not found.
解决办法:
执行命令: sudo yum install libxml2-devel
查看是否成功: find / -name "xml2-config"
出现错误: congigure error: Cannot find OpenSSL's <evp.h>
解决办法:
yum install openssl openssl-devel
ln -s /usr/lib64/libssl.so /usr/lib/
出现错误: configure: error: Please reinstall the BZip2 distribution
解决办法:yum install bzip2 bzip2-devel
出现错误: configure: error: Please reinstall the libcurl distribution -easy.h should be in <curl-dir>/include/curl/
解决办法:yum -y install curl-devel
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
sudo yum install libmcrypt libmcrypt-devel mcrypt mhash
configure: error: Please reinstall readline - I cannot find readline.h
sudo yum install readline-devel
make
make install
添加 PHP 命令到环境变量
vim /etc/profile
在末尾加入
PATH=$PATH:/usr/local/php/bin
export PATH
要使改动立即生效执行
. /etc/profile 或 source /etc/profile
查看环境变量
echo $PATH
查看php版本
php -v
PHP 5.5.13 (cli) (built: Jun 20 2014 11:11:26)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
配置php-fpm
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
启动php-fpm
sudo /usr/local/php/sbin/php-fpm
修改nginx的配置文件(/etc/nginx/conf.d/default.conf)
location / {
root web根目录;
index index.html index.htm index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME web根目录$fastcgi_script_name;
include fastcgi_params;
}
重启nginx
/etc/init.d/nginx restart
在web根目录下创建index.php
<?php echo phpinfo(); ?>
在浏览器中输入http://ip/index.php查看成功即可。
//注:根据自己的配置修改web根目录即可,如我的为/usr/share/nginx/html。
如果启动php-fpm出现错误: can not get uid for www,修改php-fpm.conf中user为nginx group为nginx
nginx安装php和php-fpm的更多相关文章
- Nginx安装配置PHP(FastCGI)环境的教程
这篇是Nginx安装配置PHP(FastCGI)环境的教程.Nginx不支持对外部程序的直接调用或者解析,所有的外部程序(包括PHP)必须通过FastCGI接口来调用. 一.什么是 FastCGI F ...
- Linux中Nginx安装与配置详解
转载自:http://www.linuxidc.com/Linux/2016-08/134110.htm Linux中Nginx安装与配置详解(CentOS-6.5:nginx-1.5.0). 1 N ...
- Linux环境Nginx安装与调试以及PHP安装
linux版本:64位CentOS 6.4 Nginx版本:nginx1.8.0 php版本:php5.5.28 1.编译安装Nginx 官网:http://wiki.nginx.org/Instal ...
- centos下nginx安装和配置
注:此文是根据前辈的博客和自己实际动手总结出来的,不喜勿喷 1.准备工作 Nginx的安装依赖于以下三个包,意思就是在安装Nginx之前首先必须安装一下的三个包,注意安装顺序如下: 1 SSL功能需要 ...
- zabbix 3.0.3 (nginx)安装过程中的问题排错记录
特殊注明:安装zabbix 2.4.8和2.4.6遇到2个问题,如下:找了很多解决办法,实在无解,只能换版本,尝试换(2.2.2正常 | 3.0.3正常)都正常,最后决定换3.0.3 1.Error ...
- Nginx 安装以及反向代理配置(windows)
安装 windows 下 Nginx 安装非常简单,下载地址 http://nginx.org/en/download.html. 选择红框这个,下载下来是个 zip 文件,解压.这时我们双击根目录的 ...
- nginx安装与配置
一.在线安装 ubuntu 安装 sudo apt-get install nginx 安装后文件结构为: 配置文件:/etc/nginx ,并且每台虚拟主机已经安排在 /etc/nginx/site ...
- Windows下将nginx安装为服务运行
今天看到nginx这个小服务器软件正式版更新到了1.4.2,想玩下它.这个服务器软件虽小,但功能强大,是开源软件,有着良好的性能,被很多个人.企业,甚至大型企业所使用! 由于是在Windows下,所以 ...
- windows下nginx安装、配置与使用(转载)
目前国内各大门户网站已经部署了Nginx,如新浪.网易.腾讯等:国内几个重要的视频分享网站也部署了Nginx,如六房间.酷6等.新近发现Nginx 技术在国内日趋火热,越来越多的网站开始部署Nginx ...
- 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定
阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...
随机推荐
- FLV封装格式及分析器工具
http://blog.csdn.net/leixiaohua1020/article/details/17934487 FLV封装原理 FLV格式的封装原理,贴上来辅助学习之用. FLV(F ...
- Myeclipse开发内存溢出问题
MyEclipse开发内存溢出问题 window --> preferences --> MyEclipse --> servers --> Tomcat --> J ...
- freshStartTail 第一次启动时 抛弃旧的日志
freshStartTail [on/off] (requires v8.18.0+) Default: off This is used to tell rsyslog to seek to the ...
- PSTN
PSTN ( Public Switched Telephone Network )定义:公共交换电话网络,一种常用旧式电话系统.即我们日常生活中常用的电话网.工作原理 公共交换电话网络是一种全球语音 ...
- error: 'LOGE' was not declared in this scope
移植了下HAL,发现编译出现如下错误 error: 'LOGE' was not declared in this scope 比较了一下android4.1的 system/core/include ...
- SQL Server 2008R2 数据库出现“可疑”导致无法访问
日常对Sql Server 2005关系数据库进行操作时,有时对数据库(如:Sharepoint网站配置数据库名Sharepoint_Config)进行些不正常操作如数据库在读写时而无故停止数据库,从 ...
- MFC CVIew关闭时崩溃
记得看视频的时候老师说过 创建CView的时候,也就是创建视图的时候,不要使用 Cview m_view;这种方式 而是使用Cview * pView=new Cview() ...
- MongoDB中ObjectId的误区,以及引起的一系列问题
近期对两个应用进行改造,在上线过程中出现一系列问题(其中一部分是由于ObjectId误区导致的) 先来了解下ObjectId: TimeStamp 前 4位是一个unix的时间戳,是一个int类别,我 ...
- 从零开始学习jQuery (十) jQueryUI常用功能实战
一.摘要 本系列文章将带您进入jQuery的精彩世界, 其中有很多作者具体的使用经验和解决方案, 即使你会使用jQuery也能在阅读中发现些许秘籍. 本文是实战篇. 使用jQueryUI完成制作网站 ...
- Android增量更新
http://blog.csdn.net/tu_bingbing/article/details/8538592 (转)