Home >Backend Development >PHP Problem >How to install php ldap on centos
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.
php -v |
yum search ldap |
##yum install php70w-ldap.x86 -64 |
#Then open the ldap extension in php.ini:
1
vi /usr/local/php/lib/php.ini extension=ldap.so |
| 1
3
// or this commandservice httpd restart
After completion, check the info.php page, there will be ldap module, showing enabled.
##1 2 3 | 4
5 LDAP Support enabled RCS Version $Id: 109508bbbecf73ca923b37138cbac56802f1231b $ | Total Links 0/unlimited
Vendor Name OpenLDAP
Vendor Version 20440
SASL Support Enabled
Directive Local Value Master Value
##2. Compile and installFor the installation of LDAP, you must install it first | Check the following Has it been installed? If not:
|
yum list openldap-devel |
Installation: |
|
# cp -frp /usr/lib64/libldap* /usr/lib/ |
|
(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 |
2 3 ##/usr/local/apache/bin/httpd -k restart |
// or this command |
PHP Video Tutorial
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!