Nginx和php安装及配置第二篇:安装和配置php-fpm

一、编译安装php

1、创建放置安装包的目录及下载解压:

    php下载地址:http://www.php.net/downloads.php


2、指定安装目录和运行时用的属主和属组,并启用状态监控模块等,在/soft/php/php-5.6.27下:

 ./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 installlibxml2-devel

查看是否成功: find / -name"xml2-config"

 

--------出现错误: congigure error: Cannotfind OpenSSL's <evp.h>

解决办法:

yum install opensslopenssl-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 installlibmcrypt libmcrypt-devel mcrypt mhash

 

--------出现错误configure: error:Please reinstall readline - I cannot find readline.h
解决办法:sudo yum install readline-devel


3、安装:

make

make install 


4、启动

添加 PHP 命令到环境变量

vim /etc/profile

在末尾加入

PATH=$PATH:/usr/local/php/bin

export PATH

要使改动立即生效执行

. /etc/profile source /etc/profile


5、配置php-fpm

cd /usr/local/php/etc

cp php-fpm.conf.defaultphp-fpm.conf

6、启动php-fpm

sudo /usr/local/php/sbin/php-fpm -c/etc/php.ini -y /usr/local/php/etc/php-fpm.conf

(需要手动引入php.ini文件

注意:如果启动php-fpm出现错误: cannot get uid for www,修改php-fpm.confusernginx groupnginx

ERROR: unable to bind listening socket for address ‘127.0.0.1:9000’
解决办法:
kill all php-fpm
然后重启即可。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值