当前位置:   article > 正文

php7.4源码安装_configure: error: package requirements (libxml-2.0

configure: error: package requirements (libxml-2.0 >= 2.7.6) were not me

安装依赖环境:

yum install -y make cmake gcc gcc-c++ autoconf automake libpng-devel libjpeg-devel zlib libxml2-devel ncurses-devel bison libtool-ltdl-devel libiconv libmcrypt mhash mcrypt pcre-devel openssl-devel freetype-devel libcurl-devel
  • 1

安装软件包

下载:

wget https://www.php.net/distributions/php-7.4.1.tar.gz
  • 1

解包:

tar -zxvf php-7.4.1.tar.gz
  • 1

编译:

进入解压后的文件夹中:

./configure \
--prefix=/opt/php \
--with-config-file-scan-dir=/etc/php.d \
--with-config-file-path=/opt/php/etc \
--with-mysql \
--with-mysqli \
--with-pdo_mysql \
--with-iconv-dir \
--with-zlib \
--with-libxml-dir \
--enable-xml \
--with-curl \
--enable-fpm \
--enable-mbstring \
--with-gd \
--with-openssl \
--with-mhash \
--enable-sockets \
--with-xmlrpc \
--enable-zip -enable-soap \
--with-freetype-dir \
--disable-fileinfo
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 报错:configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met:
    No package ‘libxml-2.0’ found
    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.
    解决: yum install libxml2-devel

  • 报错:configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
    No package ‘sqlite3’ found
    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.
    解决:yum install sqlite-devel

  • 报错:configure: error: Package requirements (libcurl >= 7.15.5) were not met:
    No package ‘libcurl’ found
    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.
    解决:yum install libcurl-devel

  • 报错:configure: error: off_t undefined; check your library configuration
    解决:

     [root@localhost php]# echo '/usr/local/lib64
     /usr/local/lib
     /usr/lib
     /usr/lib64'>>/etc/ld.so.conf
     [root@localhost php-7]# ldconfig -v
    
    • 1
    • 2
    • 3
    • 4
    • 5
  • 报错:configure: error: Package requirements (oniguruma) were not met:
    No package ‘oniguruma’ found
    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.
    解决:

     yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-5.9.5-3.el7.x86_64.rpm
     yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-5.9.5-3.el7.x86_64.rpm
    
    • 1
    • 2

编译安装:

make && make install
  • 1

添加命令到sbin中便于后期访问fpm

cp /opt/php/sbin/php-fpm /sbin/
  • 1

生成标准配置

进入到etc目录,执行命令:

cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default php-fpm.d/www.conf
  • 1
  • 2

启动:

php-fpm -y /opt/php/etc/php-fpm.conf -R

检测php是否安装成功

一、在Nginx服务器的访问地址下建立一个index.php文件,文件内容如下。

<?php
echo phpinfo();
?>
  • 1
  • 2
  • 3

二、在nginx.conf文件的server块儿中添加如下代码

location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

三、在浏览器中访问该文件,如果能访问到phpinfo即安装php成功。

卸载php

(1)查询已经安装了的mysql包

#rpm –qa|grep php
  • 1

(2)使用yum完全卸载

# yum remove 查询出来的依赖文件
  • 1

(3)手工删除所创建的目录及文件

#rm –rf /opt/php
#rm /etc/php.d
  • 1
  • 2

(4)手工删除所创建的软链接

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/989077
推荐阅读
相关标签
  

闽ICP备14008679号