安装成功的样子:
[root@localhost /]# systemctl status php-fpm ● php-fpm.service - php-fpm Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2020-04-02 15:22:00 CST; 2 days ago Main PID: 6251 (php-fpm) Tasks: 4 CGroup: /system.slice/php-fpm.service ├─2298 php-fpm: pool www ├─6251 php-fpm: master process (/opt/php/etc/php-fpm.conf) ├─6474 php-fpm: pool www └─9585 php-fpm: pool www Apr 02 15:22:00 localhost systemd[1]: Starting php-fpm... Apr 02 15:22:00 localhost systemd[1]: Started php-fpm. [root@localhost /]# [root@localhost /]# /opt/php/bin/php -version PHP 7.3.16 (cli) (built: Mar 31 2020 16:20:17) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies [root@localhost /]# [root@localhost /]#cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.6 (Maipo) [root@localhost /]#
平台:RedHat Linux 7.6
编译命令
适合于php ver 5 到 php 7.4.4,不同的版本部分参数不生效,编译时会自动忽略,该编译参数已包含常用的库。
./configure \ --prefix=/opt/php \ --with-config-file-path=/usr/local/php/etc \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-iconv-dir \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir \ --with-gettext \ --with-zlib \ --with-gd \ --with-curl \ --with-mhash \ --with-openssl \ --with-xmlrpc \ --with-bz2 \ --with-gettext \ --with-xsl \ --with-ldap \ --with-kerberos \ --with-libdir=lib64 \ --with-pcre-regex \ --with-pear \ --with-png-dir \ --with-imap-ssl \ --with-imap \ --enable-xml \ --disable-rpath \ --enable-bcmath \ --enable-pcntl \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --enable-pcntl \ --enable-session \ --enable-libxml \ --enable-sockets \ --enable-soap \ --enable-short-tags \ --enable-static \ --enable-ftp \ --enable-opcache \ --enable-ctype \ --enable-calendar \ --enable-mbregex \ --enable-mbstring \ --enable-dom \ --enable-zip \ --with-libevent \ --with-mcrypt \ --enable-gd-native-ttf \ --enable-gd \ --with-zip \ --with-freetype \ --with-jpeg \ make make install cp php.ini-development /opt/php/etc/php.ini cp /opt/php/etc/php-fpm.conf.default /opt/php/etc/php-fpm.conf cp /opt/php/etc/php-fpm.d/www.conf.default /opt/php/etc/php-fpm.d/www.conf
添加服务
vi /lib/systemd/system/php-fpm.service 写入以下内容(注意路径) [Unit] #服务描述 Description=php-fpm #服务类别 After=network.target [Service] #后台运行的方式 Type=forking #运行命令 ExecStart=/www/lnmp/php/sbin/php-fpm #独立的临时空间 PrivateTmp=true [Install] WantedBy=multi-user.target
服务启停命令:
systemctl start php-fpm systemctl stop php-fpm systemctl restart php-fpm systemctl enable php-fpm systemctl dislabe php-fpm systemctl status php-fpm
GD库没有安装
checking whether to enable JIS-mapped Japanese font support in GD... no checking for fabsf... yes checking for floorf... yes configure: error: jpeglib.h not found
解决办法
yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 libjpeg-turbo-devel -y
PHP编译出错:--enable-opcache=no
错误消息
configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no
出错的原因:
因libmcrypt是手动编译的,需要将这个编译后的库文件目录加入到/etc/ld.so.conf.d/local.conf文件中:
vim /etc/ld.so.conf.d/local.conf /usr/local/lib ldconfig
LDAP编译不通过的解决办法
故障现象:
configure: error: Cannot find ldap.h
解决办法:
yum install openldap-devel -y
如果安装了openldap-devel1还是不行,尝试继续下面的命令
cp -frp /usr/lib64/libldap* /usr/lib/
如果上述都无法解决,请留言
解决 utf8_mime2text() has new signature 问题
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information. yum install libc-client-devel
解决 libxslt 问题
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution yum install libxslt-devel -y