安装php7.2
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php72w-fpm php72w-cli php72w-gd php72w-mcrypt php72w-mysql php72w-pear php72w-xml php72w-mbstring php72w-pdo php72w-json php72w-pecl-apcu php72w-pecl-apcu-devel php72w-ldap
安装smbclient扩展
yum install libsmbclient libsmbclient-devel -y
wget https://pecl.php.net/get/smbclient-1.0.0.tgz
pecl install smbclient-1.0.0.tgz
一开始直接执行命令安装pecl install smbclient会失败,后来再网上找到上面的方法,先把对应的包下载,然后再执行pecl install smbclient-1.0.0.tgz,中间遇到了因服务器没装gcc gcc-c++导致报错,yum install gcc gcc-c++即可
配置php.ini
echo "extension=smbclient.so" >>/etc/php.ini && systemctl restart php-fpm
查看smbclient扩展
php -m|grep smbclient