![PHP是世界上最好的编程语文,不接受反驳](/api/file/getImage?fileId=5dfc82d9e8ede66f0c0000ee) 最近看到一款PHP版本的在线笔记,[Wizard](https://github.com/mylxsw/wizard),尝试一下,需要安装一些扩展,比如ldap,fileinfo,redis等,除了ldap外,其它的可以在宝塔面板中解决,这里记录一下安装的过程 ## 检查当前的PHP版本号 ```bash php -i |grep Version ``` 输出结果 ``` PHP Version => 7.3.12 PHP Version => 7.3.12 ...... ``` ## 下载、解压源码包 ```bash wget http://au1.php.net/distributions/php-7.3.12.tar.bz2 tar -jxvf php-7.3.12.tar.bz2 ``` ## 执行phpize ```bash cd php-7.3.12/ext/ldap/ /www/server/php/73/bin/phpize ./configure --with-php-config=/www/server/php/73/bin/php-config --with-ldap ``` 有报错: ```bash configure: error: Cannot find ldap.h ``` ## 安装openldap ```bash yum install openldapyum //提示没有这个包的话,可以忽略 yum install openldap-devel ``` 继续尝试 ``` ./configure --with-php-config=/www/server/php/73/bin/php-config --with-ldap ``` 又报错: ``` configure: error: Cannot find ldap libraries in /usr/lib ``` 好吧,放到你能找到的目录: ``` cp -frp /usr/lib64/libldap* /usr/lib/ ``` 继续: ``` ./configure --with-php-config=/www/server/php/73/bin/php-config --with-ldap ``` 执行成功后,最后几行会提示: ``` checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no creating libtool appending configuration tag "CXX" to libtool configure: creating ./config.status config.status: creating config.h ``` ## 编译安装 ``` make & make install ``` 正常的话,会提示: ``` Build complete. Don't forget to run 'make test'. Installing shared extensions: /www/server/php/73/lib/php/extensions/no-debug-non-zts-20170718/ ``` ## 修改php.ini中的ldap扩展,删除注释即可 ``` extension=ldap ``` 保存退出后直接在宝塔面板重启php-fpm ## 确认 ``` php -m | grep ldap ``` 看到有提示即可。 ## 完整步骤 ``` yum install openldapyum yum install openldap-devel wget http://au1.php.net/distributions/php-7.3.12.tar.bz2 tar -jxvf php-7.3.12.tar.bz2 cd php-7.3.12/ext/ldap/ /www/server/php/73/bin/phpize ./configure --with-php-config=/www/server/php/73/bin/php-config --with-ldap make & make install ``` 最后修改:5年前 © 著作权归作者所有