终于解决ERROR: PHP's 'ldap' extension is not installed/enabled. Please check your MR

我的系统是centos,php是yum的5.6.40,php-ldap也是yum的5.6.40,配置好ldap后,登录时提示ERROR: PHP's 'ldap' extension is not installed/enabled. Please check your MRBS and web server configuration.

先是查看系统日志,或者php -m,提示:PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/ldap.so' - /usr/lib64/php/modules/ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0

最后的解决思路:先下载php5.6.40包,解压缩得到php-ldap5.6.40,上传到服务器,解压缩,准备环境

phpize

./configure

这里会报错,报错内容都在最后,第一次:

configure: error: in `/root/php-5.6.4/ext/ldap':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

解决方案,安装gcc,yum install gcc

第二次:configure: error: Cannot find ldap.h

解决办法:yum install openldap openldap-devel -y

第三次:configure: error: Cannot find ldap libraries in /usr/lib.

解决办法:cp -frp /usr/lib64/libldap* /usr/lib/

然后继续./configure,最后提示

config.status: creating config.h

config.status: executing libtool commands

一切正常,然后

make

make install

至此问题解决!如果帮到了你,请留言让我知道!