一、编译安装php 7.4.x

参考CentOS 8.0.1905编译安装Nginx1.16.1+MySQL8.0.18+PHP7.3.10

1、安装编译工具及库文件(使用yum命令安装)

yum install apr* autoconf automake bison bzip2 bzip2* cpp curl curl-devel fontconfig fontconfig-devel freetype-devel gcc gcc-c++ gd gd-devel gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libxml* libXaw-devel libXmu-devel libtiff libtiff* make openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils telnet wget zlib-devel ncurses-devel libtirpc-devel gtk* ntpstat bison* sqlite-devel  oniguruma libzip-devel

2、编译php 7.4.x 需要安装oniguruma

cd /usr/local/src

wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz

或者

wget http://down.24kplus.com/linux/oniguruma/oniguruma-6.9.4.tar.gz

tar -zxf oniguruma-6.9.4.tar.gz

cd oniguruma-6.9.4

./autogen.sh

./configure --prefix=/usr

make

make install

3、编译php 7.4.x 需要安装libzip

cd /usr/local/src

wget https://nih.at/libzip/libzip-1.2.0.tar.gz

tar -zxvf libzip-1.2.0.tar.gz

cd libzip-1.2.0

./configure

make

make install

cp /usr/local/lib/libzip/include/zipconf.h  /usr/local/include/zipconf.h

#拷贝文件,否则安装php可能会报错 /usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or dire

4、php 7.4.x编译参数

export LD_LIBRARY_PATH=/usr/local/libgd/lib #设置libgd库环境变量

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" #设置libzip环境变量

./configure --prefix=/usr/local/php74 --with-config-file-path=/usr/local/php74/etc --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-gd --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-xpm=/usr/lib64 --with-zlib-dir=/usr/local/zlib --with-iconv --with-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --with-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctype --enable-mysqlnd --enable-pdo

make #编译

make install #安装

./configure --help #可以查看编译参数的写法

5、编译php报错

5.1 没有设置libzip环境变量export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"

No package 'libzip' found

checking for libzip >= 0.11... no

configure: error: Package requirements (libzip >= 0.11) were not met:

No package 'libzip' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you

installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBZIP_CFLAGS

and LIBZIP_LIBS to avoid the need to call pkg-config.

See the pkg-config man page for more details.

5.2缺少sqlite3库 yum install  sqlite-devel

error: Package requirements (sqlite3 > 3.7.4) were not met

error: Package requirements (sqlite3 > 3.7.4) were not met

No package 'sqlite3' found

5.3缺少oniguruma 编译安装oniguruma

error: Package requirements (oniguruma) were not met

error: Package requirements (oniguruma) were not met

No package 'oniguruma' found

二、编译安装php 5.6.x

1、安装低版本的openssl

CentOS 8.x默认的openssl版本太高,与php 5.6.x不兼容,需要降低openssl版本才能编译成功

which openssl #查询openssl目录,如/usr/include/openssl

openssl version #查看openssl版本

cd /usr/local/src

mkdir /usr/local/openssl101e

tar zxvf openssl-1.0.1e.tar.gz

cd openssl-1.0.1e

./config --prefix=/usr/local/openssl101e

make

make install

如果安装报错:

cms.pod around line 457: Expected text after =item, not a number

cms.pod around line 461: Expected text after =item, not a number

cms.pod around line 465: Expected text after =item, not a number

cms.pod around line 470: Expected text after =item, not a number

cms.pod around line 474: Expected text after =item, not a number

POD document had syntax errors at /usr/bin/pod2man line 69.

make: *** [install_docs] Error 1

rm -f /usr/bin/pod2man #执行本行代码,再重新编译安装

export PATH=/usr/local/openssl101e/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/openssl101e/lib

export LC_ALL="en_US.UTF-8"

export LDFLAGS="-L/usr/local/openssl101e/lib -Wl,-rpath,/usr/local/openssl101e/lib"

2、php 5.6.x编译参数

./configure --prefix=/usr/local/php56 --with-config-file-path=/usr/local/php56/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd=/usr/local/libgd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/lib64 --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl-dir=/usr/local/openssl101e --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype --enable-mysqlnd

#注意--with-openssl-dir=/usr/local/openssl101e 是我们安装的openssl低版本目录

二、编译安装php 5.3.x

CentOS 8.x默认的openssl版本太高,与php 5.3.x不兼容,需要降低openssl版本才能编译成功

php 5.3.x 需要低版本的gd库gd-2.0.35.tar.gz

gd-2.0.35库编译参数

./configure --prefix=/usr/local/gd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/lib64 --with-tiff=/usr/local/tiff --with-vpx=/usr/local/libvpx

php 5.3.x编译参数

./configure --prefix=/usr/local/php53 --with-config-file-path=/usr/local/php53/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd=/usr/local/gd --with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-freetype-dir=/usr/lib --with-iconv --with-zlib-dir=/usr/local/zlib --enable-xml --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl-dir=/usr/local/openssl101e --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype --with-mysqli=shared --enable-mysqlnd

注意:--with-openssl-dir=/usr/local/openssl101e 是我们安装的openssl低版本目录

CentOS 8.x下编译安装php 5.5 php 5.4也和php 5.6一样,需要降低openssl版本才能编译成功。

至此,CentOS 8.x下编译php 7.4、php5.6、php5.3多版本报错处理教程完成。

以上纯用于个人笔记用,原文转载于系统运维网,原文链接:https://www.osyunwei.com/archives/10467.html

CentOS 8.x下编译php 7.4、php5.6、php5.3多版本报错处理教程的更多相关文章

  1. 不要着急改代码,先想想--centos 6.8下编译安装tmux

    诸位读者新年好,2017开年第一篇博客,请允许我先问候一下看到这篇博客的诸位.写博客是我2017年定下的目标之一,希望我会坚持下去. 最近打算尝试一下tmux这个神器,于是有了这一篇关于思维方式的Bl ...

  2. centos 6.x下编译dpdk 16.7 心得

    之前对dpdk编译了解得较少,之前直接就把centos yum update了,造成测试经理部署的centos 6.5升级为6.9,造成dpdk编译出错. 先说说centos 6.9下编译的心得: 1 ...

  3. Linux下编译程序时,经常会遇到“undefined reference to XXX” 报错,

    Linux下编译程序时,经常会遇到“undefined reference to XXX” 报错, 这里总结一些可能的原因和解决方案,给需要的朋友: 说道undefined reference err ...

  4. 解决:eclipse导入android时工程下没有R文件的问题,以及style.xml文件报错

    解决:eclipse导入android时工程下没有R文件的问题,以及style.xml文件报错

  5. CentOS 6.4下编译安装MySQL 5.6.14

    概述: CentOS 6.4下通过yum安装的MySQL是5.1版的,比较老,所以就想通过源代码安装高版本的5.6.14. 正文: 一:卸载旧版本 使用下面的命令检查是否安装有MySQL Server ...

  6. Centos 7环境下编译mysql 5.7

    首先在编译之前,我们要了解相关mysql 5.7的编译选项,官网编译选项地址:http://dev.mysql.com/doc/refman/5.7/en/source-configuration-o ...

  7. CentOS 6.4下编译安装MySQL 5.6.14 (转)

    CentOS 6.4下通过yum安装的MySQL是5.1版的,比较老,所以就想通过源代码安装高版本的5.6.14. 正文: 一:卸载旧版本 使用下面的命令检查是否安装有MySQL Server rpm ...

  8. 0622 CentOS 6.4下编译安装MySQL 5.6.14

    转自http://www.cnblogs.com/xiongpq/p/3384681.html 概述: CentOS 6.4下通过yum安装的MySQL是5.1版的,比较老,所以就想通过源代码安装高版 ...

  9. centos 6.5下编译安装、配置高性能服务器Nginx

    1.nginx是什么? Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,由俄罗斯的程序设计师Igor Sysoev所开发,其特点是占有内存少,并发能力 ...

  10. 转:CentOS上安装LAMP之第三步:MySQL环境及安装过程报错解决方案(纯净系统环境)

    这是AMP运行环境中最后配置的环境: 惯例传送门: 1.编译安装MySQL cd /home/zhangatle/tar tar zxvf mysql-.tar.gz cd mysql- cmake ...

随机推荐

  1. jenkin创建任务

    第一步新建项目 第二步创建任务名称

  2. C++11之线程库

    在 C++11 之前,涉及到多线程问题,都是和平台相关的,比如 Windows 和 Linux 下各有自己的接口,这使得代码的可移植性比较差.C++11 中最重要的特性就是对线程进行支持了,并且可以跨 ...

  3. Linux 扩容 / 根分区(LVM+非LVM)

    目录: 1,概述 2,CentOS7,LVM根分区扩容步骤 3,CentOS7,非LVM根分区扩容步骤: 一.背景,概述 MBR(Master Boot Record)(主引导记录)和GPT(GUID ...

  4. 从零搭建hadoop集群之系统管理操作

    1. 配置主机名 [root@hadoop01 ~]# hostname #显示当前主机名 方法一:通过配置文件/etc/hostname (重启后生效) [root@hadoop01 ~]# vim ...

  5. CAD轴测图怎么画?快来试试浩辰CAD超级轴测命令!

    很多新手设计师小伙伴,不知道CAD轴测图怎么画?其实很简单,浩辰CAD中的超级轴测功能,可以方便地将CAD平面图转化为轴侧图,是绘制管线系统图的好帮手.今天就和小编一起来看看在浩辰CAD软件中通过调用 ...

  6. Web安全测试之XSS【转】

    作者: 小坦克  来源: 博客园   原文链接:http://www.cnblogs.com/TankXiao/archive/2012/03/21/2337194.html XSS 全称(Cross ...

  7. SY有了不适症状吃抗过敏药试试

    有了不适症状吃抗过敏药试试 Therapy for the eyes Providing welcome relief from the effects of daily stresses on th ...

  8. webapp 增加 springmvc框架 支持

    1.通过maven创建一个webapp项目,并在IDEA 中增加smart tomcat的插件. 2.然后在pom文件中添加springmvc的依赖 <!-- ServletAPI --> ...

  9. 吴恩达老师机器学习课程chapter10——推荐算法

    吴恩达老师机器学习课程chapter10--推荐算法 本文是非计算机专业新手的自学笔记,高手勿喷. 本文仅作速查备忘之用,对应吴恩达(AndrewNg)老师的机器学期课程第十六章. 缺少数学证明,仅作 ...

  10. Qt中的线程编程

    在基于操作系统的程序设计中,在处理多任务时,可以有多种方法,但效率较高的当属线程方式,下面就来讨论一下在Qt中如何实现线程编程. 先来说一下什么是线程.线程(thread)是操作系统能够进行运算调度的 ...