PHP安装,报错信息和解决过程

2023-05-06,,

PHP安装:

wget http://cn2.php.net/distributions/php-5.3.28.tar.gz
tar zxf php-5.3.28.tar.gz
cd php-5.3.28
./configure   --prefix=/usr/local/php 
 --with-apxs2=/usr/local/apache2/bin/apxs 
 --with- 

      config-file-path=/usr/local/php/etc 
 --with-mysql=/usr/local/mysql   --with-libxml-dir 

     --with-gd 
 --with-jpeg-dir   --with-png-dir   --with-freetype-dir 
 --with-iconv-dir   --with-

    zlib-dir   --with-bz2   --with-openssl 
 --with-mcrypt   --enable-soap   --enable-gd-native-ttf

     
--enable-mbstring   --enable-sockets   --enable-exif   --disable-ipv6

make && make install

报错一:configure: error: xml2-config not found. Please check your libxml2 installation.

    原因:缺少libxm文件

    解决方法:yum -y install libxml2*

【转载】重装mysql+apache+php,configure php的时候得到错误信息

shell#./configure --with-mysql=/usr/lib/mysql--with-apxs2=/usr/local/apache/bin/apxs
--prefix=/usr/local/php
configure: error: xml2-config not
found. Please check your libxml2 installation.
错误原因,xml2-config这个文件没找到。
/*原因可能出在我这次安装redhat,有很多东西没选上,所以出此问题。*/
根据错误提示,安装libxml2。RHEL_5.2的安装光盘上提供了很多rpm包,我的是dvd光盘,位置在/media/RHEL_5.2
i386 DVD/Server,
cd /media/RHEL_5.2 i386 DVD/Server
ls *libxml*

[root@localhost Server]# ls *libxml*
libxml2-2.6.26-2.1.2.1.i386.rpm       libxml2-python-2.6.26-2.1.2.1.i386.rpm
libxml2-devel-2.6.26-2.1.2.1.i386.rpm perl-libxml-perl-0.08-1.2.1.noarch.rpm
[root@localhost Server]# rpm -ivh
libxml2-python-2.6.26-2.1.2.1.i386.rpm
warning:
libxml2-python-2.6.26-2.1.2.1.i386.rpm: Header V3
DSA signature: NOKEY, key ID 37017186
Preparing...               ########################################### [100%]
       package
libxml2-python-2.6.26-2.1.2.1 is already installed /*提示我已经安装过了*/
[root@localhost Server]# rpm -ivh
libxml2-devel-2.6.26-2.1.2.1.i386.rpm
warning:
libxml2-devel-2.6.26-2.1.2.1.i386.rpm: Header V3
DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
       zlib-devel is needed by
libxml2-devel-2.6.26-2.1.2.1.i386
[root@localhost Server]# ls *zlib-devel*
zlib-devel-1.2.3-3.i386.rpm
[root@localhost Server]# rpm -ivh zlib-devel-1.2.3-3.i386.rpm
warning:
zlib-devel-1.2.3-3.i386.rpm: Header V3 DSA
signature: NOKEY, key ID 37017186
Preparing...               ########################################### [100%]
  1:zlib-devel            ########################################### [100%]
[root@localhost Server]# rpm -ivh
libxml2-devel-2.6.26-2.1.2.1.i386.rpm
warning:
libxml2-devel-2.6.26-2.1.2.1.i386.rpm: Header V3
DSA signature: NOKEY, key ID 37017186
Preparing...               ########################################### [100%]
  1:libxml2-devel         ########################################### [100%]
[root@localhost Server]#

好了,没有问题了,
make
make install
安装完成

报错二:configure: error: Cannot find OpenSSL's <evp.h>

    因为缺少openssl-dev 文件

    yum -y install openssl-dev

报错三:configure: error: Please reinstall the BZip2 distribution

    缺少安装bzip2或者bzip2-devel

    查看哪些软件已安装:rpm -qa,后接可指定查找的软件

    yum -y install bzip2-devel

报错四:configure: error: jpeglib.h not found.

    缺少libjpeg库文件

    yum install  libpng.x86_64 freetype.x86_64  libpng-devel.x86_64 freetype-devel.x86_64 -y

     yum install -y libjpeg.x86_64 libjpeg-devel.x86_64

报错五:onfigure: error: mcrypt.h not found. Please reinstall libmcrypt.

    libmcrypt库没有安装

    【转载】今天在编译php的时候,出现如下错误php安装出错:configure:  error: mcrypt.h not found. Please reinstall  libmcrypt.,意思是,没有查找到mcrytp.h,需要安装libcrytp,在下面的地址下载libmarypt:
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz

安装:
  66  tar -zxvf libmcrypt-2.5.7.tar.gz  
  67  cd libmcrypt-2.5.7
  68  mkdir -p /usr/local/libmcrytp
  69  ./configure prefix=/usr/local/libmcrytp/
  70  make
  71  make install

==========================================================

如果以上方法仍然不能安装,请参考:

rpm -ivh "http://www.lishiming.net/data/p_w_upload/forum/month_1211/epel-release-6-7.noarch.rpm
yum install -y libmcrypt-devel 
因为centos6.x 默认的yum源没有libmcrypt-devel 这个包,只能借助第三方yum源。

问题6:Thank you for using PHP.

Notice: Following unknown configure options were used:

--enable-gd-native-tff

Check './configure --help' for available options

    原因PHP编译完成,但是提示--enable-gd-native-tff选项是无效的,可以不予理会

    通过./configure --help |grep *gd-native*查看该选项意思

《PHP安装,报错信息和解决过程.doc》

下载本文的Word格式文档,以方便收藏与打印。