le-mbstring --enable-pdo --with-curl --disable-debug --disable-rpath \
--enable-inline-optimization --with-bz2 --with-zlib --enable-sockets \
--enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex \
--with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli \
--with-gd --with-jpeg-dir --with-freetype-dir --enable-calendar\
# make && make install
我在执行configure时,发生报错:Please reinstall the libzip distribution 于是我删除了旧版的libzip“yum remove libzip”,之后下载libzip源码包进行本地执行configure+make&&make install
执行libzip的安装:
# wget https://libzip.org/download/libzip-1.5.2.tar.gz
# tar -zxf libzip-1.2.0.tar.gz
# cd libzip-1.2.0
# ./configure
# make && make install
PHP安装新问题:安装执行configure时报错
configure: error: off_t undefined; check your library configuration
解决方法:
vim /etc/ld.so.conf
#添加如下几行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
#保存退出
:wq
ldconfig -v # 执行命令,使之生效
报错:configure: WARNING: unrecognized options: --with-mcrypt
解决方法:PHP 7.2+不支持 --with-mcrypt ; --enable-gd-native-ttf
# ./configure --prefix=/usr/local/php --enable-fpm \
--enable-mbstring --enable-pdo --with-curl --disable-debug --disable-rpath \
--enable-inline-optimization --with-bz2 --with-zlib --enable-sockets \
--enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex \
--with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli \
--with-gd --with-jpeg-dir --with-freetype-dir --enable-calendar\
其它错误可以参考百度/Google解决(常见php安装的方案)!
至此!PHP-fpm安装的基本流程结束了,下一步就需要配置文件
用户配置文件
# cp php.ini-production /usr/local/php/lib/php.ini
# cd /usr/local/php
# cp etc/php.fpm.conf.default etc/php-fpm.conf
# vi etc/php-fpm.conf
vi打开php-fpm.conf文件:
将文件的尾部的索引;修改成实际的目录
include=/usr/local/php/etc/php-fpm.d/*.conf
添加用户和组:
useradd mirror
groupadd -g mirror mirror
默认情况下,etc/php-fpm.d/目录下有一个“www .conf.defalut”用户配置文件
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# vi /usr/local/php/etc/php-fpm.d/www.conf
修改“www.conf"文件中的user和group的value;添加用户和组
user = mirror
group = mirror
# /usr/local/php/sbin/php-fpm
# ps aux | grep php-fpm [验证服务启动]
# netstat -tln | grep 9000 [验证网络端口是否使用]
[root@localhost /]# ps aux | grep php-fpm
root 41831 0.0 0.3 221264 6220 ? Ss 08:54 0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
mirror 41832 0.0 0.2 221264 5748 ? S 08:54 0:00 php-fpm: pool www
mirror 41833 0.0 0.2 221264 5748 ? S 08:54 0:00 php-fpm: pool www
root 41835 0.0 0.0 110292 916 pts/0 R+ 08:54 0:00 grep --color=auto php-fpm
[root@localhost /]# netstat -tln | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
至此!php-fpm服务启动成功!
Nginx+PHP环境配置
[root@localhost nginx]# vi ./nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_l