zoukankan      html  css  js  c++  java
  • php7.2安装pgsql和pdo_pgsql报错/usr/lib64/libldap_r-2.4.so.2: undefined symbol: ber_sockbuf_io_udp的处理

    php7.2安装报错pgsql和pdo_pgsql报错/usr/lib64/libldap_r-2.4.so.2: undefined symbol: ber_sockbuf_io_udp

    报错如下:
    [05-Aug-2021 06:55:39 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_pgsql.so' (tried: /usr/local/php-7.2.24_fpm/lib/php/extensions/no-debug-non-zts-20170718/pdo_pgsql.so (/usr/lib64/libldap_r-2.4.so.2: undefined symbol: ber_sockbuf_io_udp), /usr/local/php-7.2.24_fpm/lib/php/extensions/no-debug-non-zts-20170718/pdo_pgsql.so.so (/usr/local/php-7.2.24_fpm/lib/php/extensions/no-debug-non-zts-20170718/pdo_pgsql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

    用了很久找不出问题,猜想是pgsql和安装的ldap扩展冲突

    # 和pgsql冲突的 php 编译参数

    ./configure  --prefix=/usr/local/php-7.2.24_fpm --with-config-file-path=/usr/local/php-7.2.24_fpm/etc --with-openssl=/usr/local/lab/openssl-1.0.2p --with-libxml-dir=/usr --with-zlib-dir=/usr/local/lab/zlib-1.2.11 --with-bz2 --enable-calendar --with-curl=/usr/local/lab/curl-7.36.0 --enable-dba --enable-exif --enable-ftp --with-jpeg-dir=/usr/local/lab/jpeg-9b --with-png-dir=/usr/local/lab/libpng-1.6.10/ --with-freetype-dir=/usr/local/lab/freetype-2.5.4 --with-gd=/usr/local/lab/libgd-2.1.1 --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4.23 --with-mcrypt=/usr/local/lab/libmcrypt-2.5.8_php7.2 --with-mhash=/usr/local/lab/mhash-0.9.9.9 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-unixODBC=/usr/local/lab/unixODBC-2.3.2 --with-pdo-dblib=/usr/local/lab/freetds-0.92 --enable-zip --with-iconv-dir=/usr/local/lab/libiconv-1.14 --with-fpm-user=apache --with-fpm-group=users --enable-fpm --with-xmlrpc --enable-soap --enable-mbregex --enable-opcache --enable-inline-optimization --enable-xml --enable-sockets --disable-debug --enable-pcntl --enable-shmop

    于是去掉 --with-ldap=/usr/local/openldap-2.4.23 这句ldap的扩展,重新编译了php

    # 为了避免干扰已有的php程序,安装到了新的目录  /usr/local/php-7.2.24_fpm_pgsql
    # 重新编译参数

    ./configure  --prefix=/usr/local/php-7.2.24_fpm_pgsql --with-config-file-path=/usr/local/php-7.2.24_fpm_pgsql/etc --with-openssl=/usr/local/lab/openssl-1.0.2p --with-libxml-dir=/usr --with-zlib-dir=/usr/local/lab/zlib-1.2.11 --with-bz2 --enable-calendar --with-curl=/usr/local/lab/curl-7.36.0 --enable-dba --enable-exif --enable-ftp --with-jpeg-dir=/usr/local/lab/jpeg-9b --with-png-dir=/usr/local/lab/libpng-1.6.10/ --with-freetype-dir=/usr/local/lab/freetype-2.5.4 --with-gd=/usr/local/lab/libgd-2.1.1 --with-gettext --enable-mbstring --with-mcrypt=/usr/local/lab/libmcrypt-2.5.8_php7.2 --with-mhash=/usr/local/lab/mhash-0.9.9.9 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-unixODBC=/usr/local/lab/unixODBC-2.3.2 --with-pdo-dblib=/usr/local/lab/freetds-0.92 --enable-zip --with-iconv-dir=/usr/local/lab/libiconv-1.14 --with-fpm-user=apache --with-fpm-group=users --enable-fpm --with-xmlrpc --enable-soap --enable-mbregex --enable-opcache --enable-inline-optimization --enable-xml --enable-sockets --disable-debug --enable-pcntl --enable-shmop

    # 安装pgsql和pdo_pgsql

    yum -y install postgresql-devel
    # pgsql

    /usr/local/src/php-7.2.24/ 为源码目录

    cd /usr/local/src/php-7.2.24/ext/pgsql
    /usr/local/php-7.2.24_fpm_pgsql/bin/phpize
    ./configure --with-php-config=/usr/local/php-7.2.24_fpm_pgsql/bin/php-config
    make && make install

    # pdo_pgsql

    cd /usr/local/src/php-7.2.24/ext/pdo_pgsql
    /usr/local/php-7.2.24_fpm_pgsql/bin/phpize
    ./configure --with-php-config=/usr/local/php-7.2.24_fpm_pgsql/bin/php-config
    make && make install

    # 使用php自带的扩展安装ldap插件

    yum install openldap openldap-devel -y
    
    ln -sv  /usr/lib64/libldap* /usr/lib/ 
    cd /usr/local/src/php-7.2.24/ext/ldap
    /usr/local/php-7.2.24_fpm_pgsql/bin/phpize
    ./configure --with-php-config=/usr/local/php-7.2.24_fpm_pgsql/bin/php-config
    make && make install

    # 报错的处理
    /usr/bin/ld: cannot find -lpng12
    collect2: error: ld returned 1 exit status
    make: *** [sapi/cli/php] Error 1

    # 解决办法
    yum install -y libpng12-devel

    ldconfig

    make clean
    # make && make install

  • 相关阅读:
    winform 计算器
    js 特效代码网址
    js 动图效果
    计算器 练习
    html frameset 练习
    SQL 仓库管理练习题
    数据库存取图片
    数据库查询Database中的表
    面向对象练习
    C#函数与SQL储存过程
  • 原文地址:https://www.cnblogs.com/reblue520/p/15108253.html
Copyright © 2011-2022 走看看