I had this very same problem and this is what I did to solve it.
Firstly my server is running CentOS Linux release 7.6.1810 (Core)
I’m using Nextcloud 18.03
and Nginx as the webserver
Now if you don’t already have it you’ll need the gcc compiler -
yum install gcc -y
Next you need to use pecl to install the smbclient
pecl install smbclient
Once this compiles correctly it will tell you to add in the extensions=smbclient.so in your php.ini file
For me this file was located in /etc/php.ini
Open up this file and find the section for extensions and add in a new line -
Restart php and nginx -
systemctl restart php-fpm
systemctl restart nginx
Now after that you should be able to add an SMB/CIFS share.
If your planning to have the permissions set in windows take effect for different users on the share you need to enable the LDAP Users and Groups Backend app in nextcloud (yum install php72w-ldap) and when creating your SMB/CIFS share globally in Nextcloud make sure you set the authentication to “Login Credentials, Save in Session”. That way when a user logs in and clicks into the share they will only be granted the permissions that the Windows file server allows. This works best with Access Based Enumeration enabled on the Windows File Share.
Hope this helps someone else. I’ve been at this for about 2 weeks and only just figured it out yesterday. Been working perfectly for me since.
I’ve over a 1000 very happy users now.