Home Backend Development PHP Problem How to install ldap extension in php

How to install ldap extension in php

Oct 20, 2021 am 09:50 AM
centos ldap php

How to install ldap extension in php: 1. Install the ldap extension online through "yum install PHP-ldap"; 2. Place "ldap.so" in the extensions directory.

How to install ldap extension in php

The operating environment of this article: centOS6.8 system, PHP7.0 version, DELL G3 computer

How to install ldap extension for php?

Installing PHP ldap extension under Centos

##There are two methods to install PHP ldap extension under Centos, for reference only.

1. Online installation

Execute the following command:

yum install PHP-ldap
Copy after login
Possible problems:

Error: php70w-common-..   conflicts with php-common-5.4.... 就是版本冲突的意思。
Copy after login
Solution:

View php Version:

php -v
Copy after login
Search for a matching version of ldap:

yum search ldap
Copy after login
Find a matching version to install (mine is php70w-ldap.x86-64)

Reinstall:

yum install php70w-ldap.x86-64
Copy after login
You will be asked to lose a y midway to confirm.

How to install ldap extension in php

Then open the ldap extension in php.ini:

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

extension=ldap.so
Copy after login
Completed, restart Apache2: service httpd restart.

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

// 或这条命令
service httpd restart
Copy after login
Copy after login
After completion, check the info.php page, there will be the ldap module, showing enabled.

ldap
LDAP Support    enabled
RCS Version    $Id: 109508bbbecf73ca923b37138cbac56802f1231b $
Total Links    0/unlimited
API Version    3001
Vendor Name    OpenLDAP
Vendor Version    20440
SASL Support    Enabled
Directive    Local Value    Master Value
ldap.max_links    Unlimited    Unlimited
Copy after login
2. Compile and install

For LDAP installation, you must install it first

Check whether the following has been installed, if not:
Check:

yum list openldap
yum list openldap-devel

安装 :
# yum install openldap
# yum install openldap-devel
 
一定要执行这条命令:
# cp -frp /usr/lib64/libldap* /usr/lib/ 
进入安装目录下
# cd /root/lnmp1.0-full/php-5.2.17/ext/ldap 
(不知道安装目录的可以用find -name "php-*" 来查找,找到你安装的对应版本的目录)
然后运行
# /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/
Copy after login
To generate such an extension, we enter the directory and place ldap.so in the extensions directory:

[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]#
Copy after login
Modify

vi /usr/local/php/etc/php.ini (Your php configuration file is not necessarily in this directory, you can view it on the info.php page)Add :

extension=ldap.so
Copy after login
Restart apache

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

// 或这条命令
service httpd restart
Copy after login
Copy after login

How to install ldap extension in php

Recommended learning: "

PHP Video Tutorial"

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

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to optimize CentOS HDFS configuration How to optimize CentOS HDFS configuration Apr 14, 2025 pm 07:15 PM

Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

Centos stops maintenance 2024 Centos stops maintenance 2024 Apr 14, 2025 pm 08:39 PM

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

PHP: Handling Databases and Server-Side Logic PHP: Handling Databases and Server-Side Logic Apr 15, 2025 am 12:15 AM

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

PHP's Purpose: Building Dynamic Websites PHP's Purpose: Building Dynamic Websites Apr 15, 2025 am 12:18 AM

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

Centos shutdown command line Centos shutdown command line Apr 14, 2025 pm 09:12 PM

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.

How to check CentOS HDFS configuration How to check CentOS HDFS configuration Apr 14, 2025 pm 07:21 PM

Complete Guide to Checking HDFS Configuration in CentOS Systems This article will guide you how to effectively check the configuration and running status of HDFS on CentOS systems. The following steps will help you fully understand the setup and operation of HDFS. Verify Hadoop environment variable: First, make sure the Hadoop environment variable is set correctly. In the terminal, execute the following command to verify that Hadoop is installed and configured correctly: hadoopversion Check HDFS configuration file: The core configuration file of HDFS is located in the /etc/hadoop/conf/ directory, where core-site.xml and hdfs-site.xml are crucial. use

Difference between centos and ubuntu Difference between centos and ubuntu Apr 14, 2025 pm 09:09 PM

The key differences between CentOS and Ubuntu are: origin (CentOS originates from Red Hat, for enterprises; Ubuntu originates from Debian, for individuals), package management (CentOS uses yum, focusing on stability; Ubuntu uses apt, for high update frequency), support cycle (CentOS provides 10 years of support, Ubuntu provides 5 years of LTS support), community support (CentOS focuses on stability, Ubuntu provides a wide range of tutorials and documents), uses (CentOS is biased towards servers, Ubuntu is suitable for servers and desktops), other differences include installation simplicity (CentOS is thin)

See all articles