Centos install php-ldap extension, summary

=

=

=

# Determine the php version so that the corresponding version can be installed;

 

# Install the corresponding ldap version

yum install -y --skip-broken openldap.x86_64 openldap-clients.x86_64 openldap-devel.x86_64 openldap-servers.x86_64 openssh-ldap.x86_64 opensips-ldap.x86_64 perl-LDAP.noarch php-ZendFramework-Ldap.noarch php-ZendFramework2-Ldap.noarch php55w-ldap.x86_64 libldb.x86_64 

 

# You can compile and install the extension from the compiled php source code

1. Install ldap

# cd ext/ldap/
# phpize
# ./configure --with-php-config=/usr/bin/php-config --with-ldap=/root/june/lnmp1.4/src/php-5.5.38/ext/ldap --with-libdir=lib64

# make  && make install 

 

2. PHP loads the ldap extension

extension_dir = "/usr/lib64/php/modules/"

extension=ldap.so 

 

3. You may need to restart the environment

/etc/init.d/php-fpm restart

/usr/local/nginx/sbin/nginx -s reload

 

# If the version of the yum source is inconsistent with the current php version, it will cause many conflicts.

For example, the default yum source is php5.3, and the current php is 5.5, then the default ldap installed using the yum source will be version 5.3, which conflicts with the current version 5.5.

At this point, the ldap and ldap-dev of ldap5.3 should be erased, and the 5.5 version of ldap and ldap-dev should be installed, as well as other dependent versions.

Note: If there is a conflict, delete the conflicting version and install the specified version.

 

Reference: https://blog.csdn.net/gpxxgpxx/article/details/60135356

1. Online installation:

      Execute yum install php-ldap

      Possible problems: Error: php70w-common-.. conflicts with php-common-5.4.... It means version conflict.

      Solution:

            Check the version of php: php -v ;

          Search for ldap that matches the version: yum search ldap, find the matching version installed (mine is php70w-ldap.x86-64)

      Reinstall yum install php70w-ldap.x86-64, you will lose a y in the middle to confirm.

      Done, restart Apache2: service httpd restart .

   After completion, check the info.php page, there will be an ldap module, showing enabled.

 

# lib64/libldap.so: undefined reference to `ber_sockbuf_io_udp'

Package conflict. In particular, manually installed packages conflict with packages installed automatically by yum.

Refer to the above steps, delete and reinstall yum.

 

# configure fails --with-ldap Cannot find ldap libraries in /usr/lib

Refer here: https://bugs.php.net/bug.php?id=49876

correct answer:

[2009-10-19 11:14 UTC] [email protected]

Your configure line is missing this: --with-libdir=lib64

[2015-04-26 15:09 UTC] 6822089 at qq dot com

Note: I kept getting an error when I installed and compiled with --with-ldap
configure: error: Cannot find ldap libraries in /usr/lib. 或者configure: error: Cannot find ldap.h
After checking that openldap-devel is installed, I gave up ldap first because it has not been solved.
I want to try the ldap extension later, so the source package directory, the installation process is successful.
cd /opt/soft/php-5.6.8/ext/ldap
  /data/php/bin/phpize
 ./configure  --with-php-config=/data/php/bin/php-config  --with-ldap  --with-libdir=lib64
Mainly --with-libdir=lib64

 

Refer here: http://blog.sina.com.cn/s/blog_61c07ac50101882h.html

# Install LNMP error: configure: error: Cannot find ldap libraries in /usr/lib

This error usually occurs when compiling and installing PHP.
The workaround is as follows:
cp -frp /usr/lib64/libldap* /usr/lib/
The possible reason is that a 64-bit system is installed, and there is this file under lib64, but it may not be in the lib folder, so copy it once.

# When compiling php, configure: error: Cannot find ldap.h

It is found that it depends on the openldap package and solves the problem through yum:

yum install openldap.i386 openldap-clients.i386 openldap-devel.i386 openldap-servers.i386

The yum installation is complete and it's ok!

But there is a problem to pay attention to here. If it is a 64-bit system, you need to change the i386 to x86_64, and then yum is fine!

# Other additions:

During the installation process, the problems that may be encountered are:

3. You may need to restart the environment

extension_dir = "/usr/lib64/php/modules/"

extension=ldap.so 

 

4. You may need to specify the source directory.

Although phpize is the current directory by default, there are so many versions of php that it is really not standard and messy.

Sometimes you need to specify the source directory, such as specifying the current directory:

--with-ldap=/root/june/lnmp1.4/src/php-5.5.38/ext/ldap

This way you won't have to go around looking for source code by default.

 

=

=

=

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326058838&siteId=291194637