必要时可以用 YUM 选择安装以下相关软件包:

#yum install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss-ldap openldap-clients openldap-servers bison bison-devel readline readline-devel libmcrypt libmcrypt-devel net-snmp-devel libXpm* libxml2 libxml2-devel patch

一、安装相关依赖包(即支持库)

1、libiconv (对文本进行编码间的转换,用它来处理中文各种编码之间的转换)

[root@test lnmp]# tar -xzf libiconv-1.14.tar.gz

[root@test lnmp]# cd libiconv-1.14

[root@test libiconv-1.14]# ./configure

[root@test libiconv-1.14]# make && make install

2、libmcrypt (实现加密功能的库)

[root@test lnmp]# tar -xzf libmcrypt-2.5.8.tar.gz

[root@test lnmp]# cd libmcrypt-2.5.8

[root@test libmcrypt-2.5.8]# ./configure

[root@test libmcrypt-2.5.8]# make && make install

[root@test libmcrypt-2.5.8]# cd libltdl/

[root@test libltdl]# ./configure --enable-ltdl-install

[root@test libltdl]# make && make install

3、mhash (哈稀函数库)

[root@test lnmp]# tar xjf mhash-0.9.9.9.tar.bz2

[root@test lnmp]# cd mhash-0.9.9.9

[root@test mhash-0.9.9.9]# ./configure

[root@test mhash-0.9.9.9]# make && make install

[root@test mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la

[root@test mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so

[root@test mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4

[root@test mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/libmcrypt.so.4.4.8

[root@test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a

[root@test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la

[root@test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so

[root@test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2

[root@test mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

[root@test mhash-0.9.9.9]# ldconfig  #不重新加模块,下面编译 mcrypt 时,检查编译环境会出错。

-----------------------------------------------------------------------------------------------------------------------------------------

在#./configure 检查 php 编译环境时可能会出现以下错误。

checking whether mhash >= 0.8.15... no

configure: error: "You need at least libmhash 0.8.15 to compile this program. http://mhash.sf.net/"

原因:

mhash编译默认安装路径是 /usr/local/,相关库在 /usr/local/lib 下。而 php 只搜索 /usr/lib/ 这个位置。所以会出现找不到 mhash 相关库的情况。

解决方法:

通过软链接的方法把 /usr/local/lib 目录下的 mhash 相关的库文件链接到 /usr/lib/ 目录下。

-----------------------------------------------------------------------------------------------------------------------------------------

4、mcrypt

[root@test lnmp]# tar -xzf mcrypt-2.6.8.tar.gz

[root@test lnmp]# cd mcrypt-2.6.8

[root@test mcrypt-2.6.8]# ./configure

[root@test mcrypt-2.6.8]# make && make install

二、源码安装 php(FastCGI 模式)

PHP-FPM 是 一个 PHP FastCGI 进程管理器,即 PHP FastCGI Progress Manager。

FastCGI 是一个可伸缩的,高速地在 web server 和脚本语言间交互的接口。FastCGI 的主要优点是把动态语言和 web server 分离开来。这种技术允许把 web server 和动态语言运行在不同的主机上,以大规模扩展和改进安全性而不损失生产效率。

php-fpm 可以和任何支持远端 FastCGI 的 web server 工作。

在 php-5.3.3 版本之后,php-fpm 已经被包含在 core 里边了,不再是第三方的包了。不需要再打补丁了。

PHP-FPM 提供了更好的 PHP 进程管理方式,可以有效控制内存和进程、可以平滑重载 PHP 配置,比 spawn-fcgi 具有更多有点,所以被 PHP 官方收录了。在 ./configure 的时候带 -–enable-fpm 参数即可开启 PHP-FPM。

1、安装 php

[root@test lnmp]# mkdir /usr/local/php

[root@test lnmp]# tar -xzf php-5.4.4.tar.gz

[root@test lnmp]# cd php-5.4.4

[root@test php-5.4.4]# ./configure --prefix=/usr/local/php \

--with-config-file-path=/usr/local/php/etc \

--with-mysql=/usr/local/mysql/ \

--with-mysqli=/usr/local/mysql/bin/mysql_config \

--with-iconv-dir=/usr/local \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-gd \

--with-libxml-dir=/usr \

--enable-xml \

--disable-rpath \

--enable-bcmath \

--enable-shmop \

--enable-sysvsem \

--enable-inline-optimization \

--with-curl \

--with-curlwrappers \

--enable-mbregex \

--enable-fpm \

--with-pdo-mysql=/usr/local/mysql \ #可选参数,如果这里指定了,在安装pdo_mysql时就不用指定了。

--enable-mbstring \

--with-mcrypt \

--enable-gd-native-ttf \

--with-openssl \

--with-mhash \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-zip \

--enable-soap \

--without-pear

[root@test php-5.4.4]# make ZEND_EXTRA_LIBS='-liconv'

[root@test php-5.4.4]# make install

configure 代码如下:

-----------------------------------------------------------------------------------------------------------------------------------------

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-gd --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --with-pdo-mysql=/usr/local/mysql --enable-mbstring --with-mcrypt --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear

-----------------------------------------------------------------------------------------------------------------------------------------

可能出现的错误:

1、configure: error: xml2-config not found. Please check your libxml2 installation.

解决方法:

http://www.xmlsoft.org/

源码安装 libxml2 或通过 yum 安装 libxml2-devel。

(1)[root@test lnmp]# tar -xzf libxml2-tests-2.8.0.tar.gz

(2)[root@test lnmp]#yum install  libxml2-devel

2、 configure: error: Please reinstall the libcurl distribution -

easy.h should be in <curl-dir>/include/curl/

解决方法:

http://curl.haxx.se/

源码安装 curl 或通过 yum 安装 libcurl-devel。

(1)[root@test lnmp]# tar -xzf curl-7.26.0.tar.gz

(2)[root@test lnmp]#yum install libcurl-devel

3、configure: error: jpeglib.h not found.

解决方法:

http://www.ijg.org/

源码安装 jpegsrc 或通过 yum 安装 libjpeg-devel。

(1)[root@test lnmp]# tar -xzf jpegsrc.v8d.tar.gz

(2)[root@test lnmp]#yum install libjpeg-devel

4、configure: error: png.h not found.

解决方法:

http://www.libpng.org/pub/png/libpng.html

源码安装 libpng 或通过 yum 安装 libpng-devel。

(1)[root@test lnmp]# tar -xzf libpng-1.5.12.tar.gz

(2)[root@test lnmp]#yum install libpng-devel

4、configure: error: freetype.h not found.

解决方法:

http://www.freetype.org/

源码安装 freetype 或通过 yum 安装 libfreetype-devel。

(1)[root@test lnmp]# tar -xzf freetype-2.4.10.tar.gz

(2)[root@test lnmp]#yum install libfreetype-devel

编译的时候可能出现的错误:

5、Generating phar.php

/data1/lnmp/php-5.4.4/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

make: *** [ext/phar/phar.php] Error 127

解决方法:

#echo "/usr/local/mysql/lib/" &gt;&gt; /etc/ld.so.conf.d/mysql-x86_64.conf

6、PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.

两种解决方法:

(1)#./configure --without-pear

(2)#wget http://pear.php.net/go-pear.phar

#php go-pear.phar

7、configure: WARNING: unrecognized options: --enable-discard-path, --enable-safe-mode

警告原因:

之前 php-5.3.x 编译时加了 --enable-safe-mode --enable-discard-path --enable-fastcgi --enable-force-cgi-redirect选项,但是这个选项没必要,且会带来许多的麻烦,详解可以 google 一下,php-5.4.x 已经去掉了该选项,编译时可以 #./configure --help | grep “safe-mode” 查看一下,没有信息输出,表示已经不支持!

-----------------------------------------------------------------------------------------------------------------------------------------

2、建立相关配置文件

[root@test php-5.4.4]# cp php.ini-production /usr/local/php/etc/php.ini

[root@test php-5.4.4]# vim /etc/profile

找到 export PATH=$PATH:/usr/local/mysql/bin 这一行,

修改为:export PATH=$PATH:/usr/local/mysql/bin:/usr/local/php/bin:/usr/local/php/sbin:

[root@test php-5.4.4]# source /etc/profile

最终 能实现的 参数,  比如msyql-config  ,还有 加密 encpty 等  不是很好找, 先减少这两个参数  安装完毕后,用到时再想办法!

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath  --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl  --enable-mbregex  --enable-fpm  --enable-mbstring  --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear --with-zlib --enable-pdo --with-pdo-mysql --with-mysql --with-apxs2=/usr/local/apache/bin/apxs

编译安装php 5.5 缺少依赖包 及解决方案的更多相关文章

  1. Liunx/RHEL6.5 Oracle11 安装记录[缺少依赖包的解决方案]

    1.将镜像文件挂,如/mnt # mount -o loop rhel-server-6.1-x86_64-dvd.iso /mnt#这一步其实有很多实现方法,如可以将镜像文件中的Packages文件 ...

  2. Linux安装软件时缺少依赖包的简单较完美解决方法!

    大家在linux下源码安装时,有木有经常碰到缺少这个包那个包的,然后不知所措?看到最近有几个筒子安装thrift,安装python因缺少依赖包而进行不下去了.我用的是红帽,装系统的时候习惯把所有的有的 ...

  3. 记录一次编译安装Pg_rman缺少依赖包的问题

    系统版本:CentOS版本6.10(最终版) pg_rman:https://github.com/ossc-db/pg_rman -bash-4.1$ makegcc -Wall -Wmissing ...

  4. dpkg安装deb缺少依赖包的解决方法

    [先贴出解决方案(基于Ubuntu)]: 使用dpkg -i   *.deb 的时候出现依赖没有安装 使用apt-get -f -y install  解决依赖问题后再执行dpkg安装deb包 === ...

  5. linux:apt-get 如何安装,查询,解除依赖包

    apt-cache search package 搜索包 apt-cache show package 获取包的相关信息,如说明.大小.版本等 sudo apt-get install package ...

  6. SAE 安装未包含的第三方依赖包

    如何使用virtualenv管理依赖关系 当你的应用依赖很多第三方包时,可以使用virtualenv来管理并导出这些依赖包,流程如下: 首先,创建一个全新的Python虚拟环境目录ENV,启动虚拟环境 ...

  7. Centos7.3 编译安装GDAL以及Python的GDAL包

    参考: https://cryolite.iteye.com/blog/176382 https://blog.csdn.net/a13326021319/article/details/782505 ...

  8. maven缺少依赖包,强制更新命令

    mvn clean install -e -U -e详细异常,-U强制更新

  9. ubuntu18.04 下 使用conda安装requirement.txt指定的依赖包

    首先创建特定的虚拟环境 conda create -n temp_test python=3.5 conda install anaconda 切换到该环境 conda activate temp_t ...

随机推荐

  1. c++11 auto unique_ptr 等

    c++11 条款21:尽量使用std::make_unique和std::make_shared而不直接使用new c++11 条款18: 使用std::unique_ptr来进行独享所有权的资源管理 ...

  2. Dedesql数据库类详解

    今天花点时间讲解下织梦的sql数据库类,近期本来是准备录制一套视频教程的,但由于视频压缩的问题迟迟没有开展工作,如果大家有什么好的视频压缩方式可以通过邮件的方式告诉我:tianya#dedecms.c ...

  3. meta标签详解(meta标签的作用)///////////////////////////转

    meta标签详解(meta标签的作用) 很多人却忽视了HTML标签META的强大功效,一个好的META标签设计可以大大提高你的个人网站被搜索到的可能性,有兴趣吗,谁我来重新认识一下META标签吧   ...

  4. 25条提高iOS app性能的方法和技巧

    以下这些技巧分为三个不同那个的级别---基础,中级,高级. 基础 这些技巧你要总是想着实现在你开发的App中. 1. 用ARC去管理内存(Use ARC to Manage Memory) 2.适当的 ...

  5. 删除已经配置的类库和移除CocoaPods[转]

    转自:http://blog.csdn.net/jymn_chen/article/details/19213601 引言 在使用CocoaPods(一)为项目配置第三方类库我们使用CocoaPods ...

  6. WLST 命令和变量

    下列部分将详细描述 WLST 命令和变量.主题包括:  WSLT 命令类别概述  浏览命令  控制命令  部署命令  诊断命令  编辑命令  信息命令  生命周期命令  节点管理器命令  树命令  W ...

  7. IsBackground的理解

    1.当在主线程中创建了一个线程,那么该线程的IsBackground默认是设置为FALSE的. 2.当主线程退出的时候,IsBackground=FALSE的线程还会继续执行下去,直到线程执行结束. ...

  8. gfortran编译Fortran数组问题

    可能是IVF(inter visual fortran)比LF(lahey Fortran)编译器比较严格的原因 real :: A(L,M) = (/ 1,2,3,4,5,6,7,8,9,10,11 ...

  9. node.js报错总结

    1. Error: EISDIR, read 这个报错是目标不应该是文件夹,而是其他类型,本错误出现在使用fs.createReadStream()里参数传递了个文件夹,但是应该传递个文件. 参考地址 ...

  10. C# Cookie工具类

    /// <summary> /// Cookies赋值 /// </summary> /// <param name="strName">主键& ...