PHP 编译版本,PHP版本5到7的源码编译安装

安装成功的样子:[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

标签:opt,enable,etc,fpm,编译,源码,conf,PHP,php

来源: https://blog.51cto.com/12641643/2484914

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值