Centos安装php php-fpm 以及 配置nginx
下载php源码包
http://www.php.net/downloads.php
安装php
tar -xvf php-5.5..tar.bz2 cd php-5.5. ./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
解决办法:
1.执行命令:
sudo yum install libxml2-devel
2.查看是否成功:
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
可能出现的错误
编译PHP5.5 make 时出现错误
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
解决办法:
这是由于内存小于1G所导致.Disable fileinfo support 禁用 fileinfo
在./configure加上选项:
--disable-fileinfo
配置环境变量
添加 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
修改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:; //这个iP和端口对应php-fpm设置的端口 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME web根目录$fastcgi_script_name; include fastcgi_params; }
检查nginx
[root@server nginx]# ./sbin/nginx -t //检测配置文件是否正常
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
则 已经配置正确
重启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
Centos安装php php-fpm 以及 配置nginx的更多相关文章
- CentOS安装Apache-2.4.10+安全配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Nginx之前,请确保已经使用yum安装了各基础组件,并且配置了www用户和用户组,具体见<CentOS ...
- CentOS 7 学习(二) 配置Nginx反向代理
CentOS 7 学习(二) 配置Nginx反向代理 Nginx可以通过php-fpm来运行PHP程序,也可以转向apache,让apache调用php程序来运行. 不过对于Nginx来说,其反向代理 ...
- CentOS安装Apache-2.4.25+安全配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Nginx之前,请确保已经使用yum安装了各基础组件,并且配置了www用户和用户组,具体见<CentOS ...
- CentOS安装Nginx-1.6.2+安全配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Nginx之前,请确保已经使用yum安装了pcre等基础组件,具体见<CentOS安装LNMP环境的基础 ...
- CentOS安装Nginx-1.6.2+安全配置+性能配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Nginx之前,请确保已经使用yum安装了pcre等基础组件,具体见<CentOS安装LNMP环境的基础 ...
- CentOS安装MySQL-5.6.10+安全配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装MySQL之前,请确保已经使用yum安装了各类基础组件,具体见<CentOS安装LNMP环境的基础组件& ...
- 【推荐】CentOS安装Tomcat-7.0.57+启动配置+安全配置+性能配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Tomcat之前,请确保已经安装了JDK-1.7环境,具体见<CentOS安装JDK-1.7>. ...
- 【推荐】CentOS安装vsftpd-3.0.2+安全配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. FTP的登录一般有三种方式,分别是: 匿名用户形式:默认安装的情况下,系统只提供匿名用户访问,只需要输入用户anonymous/f ...
- 【推荐】CentOS安装vsftpd-3.0.3+安全配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. FTP的登录一般有三种方式,分别是: 匿名用户形式:默认安装的情况下,系统只提供匿名用户访问,只需要输入用户anonymous/f ...
- centos安装mongodb 4.x及配置用户名密码(官方推荐的方式)
安装mongodb 先在本地用记事本做一个这样的文件(命名为:mongodb-org-4.0.repo): [mongodb-org-4.0] name=MongoDB Repository base ...
随机推荐
- IdentityServer Topics(7)- 注销
注销IdentityServer与删除身份cookie一样简单,但是我们必须考虑将用户从客户端应用程序(甚至可能是上游身份提供程序)中注销. 一.删除身份认证Cookie 要删除身证认证cookie, ...
- 使用mpvue开发小程序教程(五)
在上一章节中,我们了解了组件的三个基本特性以及组件的基本使用方法.在实际的小程序开发中,我们应该以组件的思维去设计每个小程序的功能页面,对其进行合理的组件拆分,让每个部分都保持功能简洁.条理清楚.各司 ...
- eclipse 创建maven 项目 动态web工程完整示例
需求表均同springmvc案例 此处只是使用maven 注意,以下所有需要建立在你的eclipse等已经集成配置好了maven了,说白了就是新建项目的时候已经可以找到maven了 没有的话需要安装m ...
- Docker快速搭建LNMP环境
一.使用Dockerfile制作镜像 前面的博客中已经介绍了如何基于容器制作镜像,此方法的原理是使用一个正在运行的容器,根据生产所需进行配置更改等操作后,使其满足生产环境,再将这个容器打包制作为镜像, ...
- xamarin.forms之实现ListView列表倒计时
做商城类APP时经常会遇到抢购倒计时的功能,之前做小区宝iOS的时候也有类似的功能,想着参考iOS做的思路,自定义一个Cell,在Cell中每秒刷新一下控件的文本值,但使用xamarin.forms实 ...
- Docker 更新镜像
docker镜像如下: 今天在运行的容器内使用 apt-get update 命令进行更新时,发下很多404错误. Err http://archive.ubuntu.com wily-updates ...
- Linux CentOS设置定时重启:crontab
上一篇介绍了 开机自启动chkconfig命令 https://www.cnblogs.com/prefectjava/p/9399470.html 本篇介绍 crontab 设置定时任务,并且把 ...
- Spring Cloud Eureka 常用配置及说明
配置参数 默认值 说明 服务注册中心配置 Bean类:org.springframework.cloud.netflix.eureka.server.EurekaServerConfigBean eu ...
- Form提交表单后页面刷新不跳转的实现
<form action="" id="" method="post" target="nm_iframe"> ...
- JavaScript大师必须掌握的12个知识点
既然你对这篇文章感兴趣,我想你应该是一位前端开发,也许你有一份不错的工作.自主创业甚至是一位自由从业者.不知你的前端技术如何,也许你是一位新手,亦或是一位资深开发. 如果你想让自己成为一个 JavaS ...