• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

Nginx和php安装及配置二之安装和配置php-fpm

php 搞代码 3年前 (2022-01-22) 16次浏览 已收录 0个评论

本篇文章给大家分享的内容是关于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

——–可能出现的错误:

出现错误: co1本文来#源gaodai$ma#com搞$代*码*网

搞代gaodaima码

ngigure 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
然后重启即可。

相关推荐:

Nginx和php安装及配置一之编译安装nginx-1.8.0



以上就是Nginx和php安装及配置二之安装和配置php-fpm的详细内容,更多请关注搞代码gaodaima其它相关文章!


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Nginx和php安装及配置二之安装和配置php-fpm

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址