• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved PHP SMB Client

James Mountfield

New Pleskian
Hi

I have been using NextCloud with Plesk and all works good - apart from the mount external storage.

From what I can see it is that SMB PHP is not available to the website hosted within plesk, I can connect from the Plesk Command Line to the SMB share but not from the website hosted.

Any advice on enabling PHP SMB for the website?

Thanks in advance.
 
Please use following instruction. It is for PHP7.2 version but you can adapt it for your PHP version as well:

# yum install gcc make plesk-php72-devel libsmbclient-devel
# /opt/plesk/php/7.2/bin/pecl install smbclient
# echo "extension=smbclient.so" > /opt/plesk/php/7.2/etc/php.d/smbclient.ini
# plesk bin php_handler --reread

As result:

# /opt/plesk/php/7.2/bin/php -m | grep smbcli
libsmbclient
smbclient
 
Hi,
i become a error after i need install smbclient or php7.3-smbclient

Code:
~ # /opt/plesk/php/7.3/bin/pecl install smbclient
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading smbclient-1.0.0.tgz ...
Starting to download smbclient-1.0.0.tgz (32,017 bytes)
.........done: 32,017 bytes

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in PEAR/PackageFile/v2/Validator.php on line 1933
PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /opt/plesk/php/7.3/share/pear/PEAR/PackageFile/v2/Validator.php on line 1933
PHP Stack trace:
PHP   1. {main}() /opt/plesk/php/7.3/share/pear/peclcmd.php:0
PHP   2. require_once() /opt/plesk/php/7.3/share/pear/peclcmd.php:31
PHP   3. PEAR_Command_Install->run() /opt/plesk/php/7.3/share/pear/pearcmd.php:316
PHP   4. PEAR_Command_Install->doInstall() /opt/plesk/php/7.3/share/pear/PEAR/Command/Common.php:270
PHP   5. PEAR_Downloader->download() /opt/plesk/php/7.3/share/pear/PEAR/Command/Install.php:666
PHP   6. PEAR_Downloader_Package->download() /opt/plesk/php/7.3/share/pear/PEAR/Downloader.php:474
PHP   7. PEAR_Downloader_Package->_fromUrl() /opt/plesk/php/7.3/share/pear/PEAR/Downloader/Package.php:262
PHP   8. PEAR_PackageFile->fromAnyFile() /opt/plesk/php/7.3/share/pear/PEAR/Downloader/Package.php:1599
PHP   9. PEAR_PackageFile->fromTgzFile() /opt/plesk/php/7.3/share/pear/PEAR/PackageFile.php:473
PHP  10. PEAR_PackageFile->fromPackageFile() /opt/plesk/php/7.3/share/pear/PEAR/PackageFile.php:377
PHP  11. PEAR_PackageFile->fromXmlString() /opt/plesk/php/7.3/share/pear/PEAR/PackageFile.php:428
PHP  12. PEAR_PackageFile_v2->validate() /opt/plesk/php/7.3/share/pear/PEAR/PackageFile.php:209
4 source files, building
running: phpize
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
building in /tmp/pear-build-rootKq46be/smbclient-1.0.0
running: /tmp/smbclient/configure --with-php-config=/opt/plesk/php/7.3/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /opt/plesk/php/7.3
checking for PHP includes... -I/opt/plesk/php/7.3/include/php -I/opt/plesk/php/7.3/include/php/main -I/opt/plesk/php/7.3/include/php/TSRM -I/opt/plesk/php/7.3/include/php/Zend -I/opt/plesk/php/7.3/include/php/ext -I/opt/plesk/php/7.3/include/php/ext/date/lib
checking for PHP extension directory... /opt/plesk/php/7.3/lib/php/modules
checking for PHP installed headers prefix... /opt/plesk/php/7.3/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.16 (ok)
checking for gawk... gawk
checking whether to enable smbclient support... yes, shared
checking for libsmbclient support... yes, shared
checking for libsmbclient.h in default paths... not found
configure: error: Could not find libsmbclient.h
ERROR: `/tmp/smbclient/configure --with-php-config=/opt/plesk/php/7.3/bin/php-config' failed
 
i have try that and i receive error when i need install dev
Code:
# apt-get install gcc make plesk-php73-devel libsmbclient-devel
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package plesk-php73-devel
E: Unable to locate package libsmbclient-devel
root@second ~ #
is installed to -> apt-get install plesk-php72-dev

Code:
~ # apt-get install plesk-php73-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
plesk-php73-dev is already the newest version (1:7.3.17-debian.9.200418.1216).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
 
My instruction was written for rpm-based operating systems, in particular for CentOS. For deb-based operating systems, like Debian or Ubuntu, package most often have different names. For example, instead of name-devel, name-dev is used.
 
Code:
~ # apt-get install gcc make plesk-php73-devel libsmbclient-devel
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package plesk-php73-devel
E: Unable to locate package libsmbclient-devel
root@second ~ # apt-get install gcc make plesk-php74-devel libsmbclient-devel
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package plesk-php74-devel
E: Unable to locate package libsmbclient-devel
root@second ~ #
 
Thank you very much that was the gol :)

For successors who do it wrong because they use debian or ubuntu;

# ap-get install gcc make plesk-php74-dev libsmbclient-dev
# /opt/plesk/php/7.4/bin/pecl install smbclient
# echo "extension=smbclient.so" > /opt/plesk/php/7.4/etc/php.d/smbclient.ini
# plesk bin php_handler --reread

As result:

# /opt/plesk/php/7.4/bin/php -m | grep smbcli
libsmbclient
smbclient
 
Last edited:
Back
Top