Home >Backend Development >PHP Problem >How to install php ldap on centos

How to install php ldap on centos

藏色散人
藏色散人Original
2021-10-19 10:43:302474browse

How to install php ldap on centos: 1. Execute the "yum install PHP-ldap" command; 2. Open the ldap extension in php.ini; 3. Restart Apache2.

How to install php ldap on centos

##1

yum install PHP-ldap


Possible problems:

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

Solution:

Check the php version:

##1php -v##Search for ldap matching version:


1 Find the matching version installation (mine is php70w-ldap.x86 -64)

yum search ldap


Reinstall:

1

##yum install php70w-ldap.x86 -64


How to install php ldap on centos</p><p></p><table class=


#Then open the ldap extension in php.ini:

1

2 12

vi /usr/local/php/lib/php.ini

extension=ldap.so


Completed, restart Apache2: service httpd restart.

3

/usr/local/ apache/bin/httpd -k restart4Total Links 0/unlimitedAPI Version 3001

// or this command

service httpd restart

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

##1

2

3

5

6

7

8

9

10

ldap

LDAP Support enabled

RCS Version $Id: 109508bbbecf73ca923b37138cbac56802f1231b $

Vendor Name OpenLDAP

Vendor Version 20440

SASL Support Enabled

Directive Local Value Master Value

ldap.max_links Unlimited Unlimited##1

##2. Compile and install

For the installation of LDAP, you must install it first
Check the following Has it been installed? If not:


Check:

2

yum list openldap1

yum list openldap-devel

Installation:

2

# yum install openldap# yum install openldap-devel


Be sure to execute this command:

1
# cp -frp /usr/lib64/libldap* /usr/lib/


Enter Under the installation directory
######1############ cd /root/lnmp1.0-full/php-5.2.17 /ext/ldap##################

(If you don’t know the installation directory, you can use find -name "php-*" to find it and find the directory of the corresponding version you installed)

Then run

1

2

3

4

5

6

7

8

9

# /usr/local/php/bin/phpize

Configuring for:

PHP Api Version: 20090626

Zend Module Api No: 20090626

Zend Extension Api No: 220090626

# ./configure --with-php- config=/usr/local/php/bin/php-config --with-ldap

# make

# make install

Installing shared extensions: /usr/local /php/lib/php/extensions/no-debug-non-zts-20131226/

Generate such an extension, we enter the directory and put ldap.so is placed in the extensions directory:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

[root@openldap ldap]# make install

Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

[root@openldap ldap]# cd /usr/local/php/lib/php /extensions/no-debug-non-zts-20131226/

[root@openldap no-debug-non-zts-20131226]# ls -l

total 748

-rwxr-xr-x 1 root root 173086 Jul 16 16:05 ldap.so

-rwxr-xr-x 1 root root 586024 Jul 16 12:04 opcache.so

[ root@openldap no-debug-non-zts-20131226]# cp ldap.so /usr/local/php/lib/php/extensions/ldap.so

[root@openldap no-debug-non- zts-20131226]# cd ..

[root@openldap extensions]# ls -l

total 176

-rwxr-xr-x 1 root root 173086 Jul 16 16:08 ldap.so

drwxr-xr-x 2 root root 4096 Jul 16 16:05 no-debug-non-zts-20131226

[root@openldap extensions]

#Modify vi /usr/local/php/etc/php.ini (your php configuration file is not necessarily this directory, you can view it on the info.php page )

Add:

1

##extension=ldap.so


Restart apache

##1

2

3

##/usr/local/apache/bin/httpd -k restart

// or this command

service httpd restart

## Recommended study: "

PHP Video TutorialHow to install php ldap on centos

The above is the detailed content of How to install php ldap on centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn