Dan's picture

I am having the darndest time trying to get smbclient and php-smbclient installed on a V15 LAMP stack.

It looks like it installed fine with:

apt install smbclient

apt install php-smbclient

Then I reboot.

but it wont show up in phpinfo(). 

I got it working great on V16 LAMP stack doing the same thing and it shows up in phpinfo()... so I took the top part where it says additional .ini files parsed... found the /etc/php/7.3/apache2/conf.d/20-smbclient.ini file. create one just like it on the V15 machine and dropped it in the same folder... but for php/7.0  and it now lists it in the top part.. but its still not loaded below.

 

Any pointers anyone?

 

Thanks!

 

Forum: 
Dan's picture

I left a message regarding setting up smbclient on a V15 TKL LAMP instance.

I did:

apt-get update

apt-get install smbclient

apt-get install php-smbclient 

Then rebooted. Checking phpinfo() I dont see smbclient as being installed.

Did the same procedure on V16 TKL LAMP instance and it works perfectly.

Tried creating file /etc/php/7.0/apache2/conf.d/20-smbclient.ini with same contents as working file on V16 instance.   Still no dice.

tried removing and reinstall smbclient with apt-get remove.... still not working.

Can anyone help point me in the right direction?

 

Jeremy Davis's picture

Firstly, apologies about the disappearing message. There is a really weird intermittent forum bug that occasionally causes the content of posts to "disappear" like that. I have spent a fair bit of time looking into it and got nowhere but I'm no PHP expert. We did have a PHP expert look at it at one point and he thought he'd fixed it, but alas it still occurs... Intermittent issues are the worst...

Anyway regarding your php-smbclient issues, TBH I'm not 100% sure, but I do have an idea.

If I compare the files within the v16.x (Buster) version of the php-smbclient package against the files within the v15.x (Stretch) version beyond the PHP versions (7.0 in Stretch; 7.2 & 7.3 in Buster), then it all looks as it should?!

Although referring back to your post, you noted that you tried copying the info from v16.x, but perhaps there is some specific v15.x related stuff that is not compatible? I'm fairly sure that the file you note should just be a symlink to the packaged file (i.e./etc/php/7.0/mods-available/smbclient.ini). As you can see from the files, the location of the "Shared Object" (i.e. the smbclient.so file) is different, so unless you adjusted for that, that may explain why your manual creation of the file didn't work?

So perhaps just try using the built-in php tool to manage mods? I.e. try this:

phpenmod smbclient
systemctl restart apache2

Hopefully that works?

If not, then please give me a little more info about the php-smbclient package you have installed. I.e.:

apt policy php-smbclient

Also, if you haven't already, maybe the Apache logs (in /var/log/apache2) might include some useful info?

Dan's picture

Thanks Jeremy!

 

Here is what happened:

root@lamp ~# phpenmod smbclient

WARNING: Module smbclient ini file doesn't exist under /etc/php/7.0/mods-available

WARNING: Module smbclient ini file doesn't exist under /etc/php/7.0/mods-available

WARNING: Module smbclient ini file doesn't exist under /etc/php/5.6/mods-available

WARNING: Module smbclient ini file doesn't exist under /etc/php/5.6/mods-available

root@lamp ~# apt policy php-smbclient

php-smbclient:

  Installed: 1.0.6-1+0~20210301.18+debian9~1.gbpbf56d3

  Candidate: 1.0.6-1+0~20210301.18+debian9~1.gbpbf56d3

  Version table:

*** 1.0.6-1+0~20210301.18+debian9~1.gbpbf56d3 500

        500 https://packages.sury.org/php stretch/main amd64 Packages

        100 /var/lib/dpkg/status

     0.8.0-3 500

        500 http://deb.debian.org/debian stretch/main amd64 Packages

 

Jeremy Davis's picture

So you have the sury.org version of php-smbclient installed, rather than the Debian version. Unfortunately, Ondrej (Sury) doesn't have an online way to check the contents of packages (as Debian do). So I downloaded it and had a look.

It turns out that the unlike the Debian php-smbclient package, the sury.org php-package is what is known as a "meta-package". A meta-package is an empty package that simply pulls in other packages (by declaring them as dependencies). And in the case of php-smbclient the sury.org package depends on a PHP version specific package; currently php8.0-smbclient. So my guess is that you have that package installed too. But as you aren't using PHP8.0, that explains why it's not working and the fact that the ini file noted by Debian doesn't exist.

So how you fix this depends on which PHP version you wish to use. Are you definitely using PHP7.0? Or do you want to be using an alternate version of PHP?

If you are happy with PHP7.0, then that's already bundled with Stretch and you shouldn't need to use sury.org. In that case, I would recommend disabling sury.org and ensure that all PHP packages are the Debian ones. I won't detail that for now, but let me know if that's something you want to do.

If you are (or want to be) using a newer version of PHP, then you'll want to keep the sury.org repo enabled. But you'll probably want to make sure that you are actually using the specific version of PHP you want to use. Unless you have some specific reason to have PHP7.0 (and/or other versions) packages installed, I'd suggest removing all PHP packages that are not the specific version of PHP you want to use.

But I do have a suggestion that should get you up and going for now (and you can clean up later). To install the PHP7.0 Debian version of php-smbclinet and hold it, so it's not auto updated next time you run 'apt upgrade', try this

apt install --allow-downgrades php-smbclient=0.8.0-3
apt-mark hold php-smbclient
systemctl restart apache2

Note that no updates at all will be applied to that package now. So not even security updates will be installed. If you're not using sury.org, this can all be fixed by removing that (then removing the hold we just put on php-smbclient). Alternatively, if you want PHP7.0 from Debian, but also still want sury.org for some reason, the answer would probably be to configure repo pinning.

If instead you are using an alternate PHP version (or want to) then (unless you're using PHP8.0), you'll need to install to install the specific sury.org PHP version package of php-smbclient. E.g. to install the PHP 7.4 version:

apt install php7.4-smbclient

Note that you could use this same method to install the PHP7.0 version of php-smbclient from sury.org repos if you wished (not recommended and not sure why you would if using PHP7.0, but YMMV). I.e. install the 'php7.0-smbclient' package with apt.

Hopefully that gets you going. If you can clarify exactly what you want re PHP versions, then I can help you clean things up. If you want a hand with that, please give me the output of the following:

# list all the enabled apt sources.list entries and the files they are in
grep -r ^deb /etc/apt/sources.list*
# list all the install PHP packages
apt-cache policy php* | grep -v 'Installed: (none)' | grep 'Installed:' -B1
# also list the versions of Apache mod_php
apt-cache policy libapache2-mod-php* | grep -v 'Installed: (none)' | grep 'Installed:' -B1
Dan's picture

Thank you for all this help!

I did as you said, but still no dice on smbclient from phpinfo() output...  is perhaps the file I created : /etc/php/7.0/apache2/conf.d/20-smbclient.ini. causing a problem?

 

Here is the output from those commands:

root@lamp ~# grep -r ^deb /etc/apt/sources.list*

/etc/apt/sources.list.d/security.sources.list:deb http://archive.turnkeylinux.org/debian stretch-security main

/etc/apt/sources.list.d/security.sources.list:deb http://security.debian.org/ stretch/updates main

/etc/apt/sources.list.d/security.sources.list:deb http://security.debian.org/ stretch/updates contrib

/etc/apt/sources.list.d/php5.list:deb https://packages.sury.org/php/ stretch main

/etc/apt/sources.list.d/sources.list:deb http://archive.turnkeylinux.org/debian stretch main

/etc/apt/sources.list.d/sources.list:deb http://deb.debian.org/debian stretch main

/etc/apt/sources.list.d/sources.list:deb http://deb.debian.org/debian stretch contrib

root@lamp ~# apt-cache policy php* | grep -v 'Installed: (none)' | grep 'Installed:' -B1

php-xdebug:

  Installed: 2.5.0-1

--

php-xml:

  Installed: 1:7.0+49

--

php7.0-cli:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php-common:

  Installed: 2:82+0~20210313.35+debian9~1.gbpa8195f

--

php7.0-gd:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php5.6:

  Installed: 5.6.40-47+0~20210227.51+debian9~1.gbpd522a2

--

php7.0-opcache:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php7.0-common:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php-pear:

  Installed: 1:1.10.12+submodules+notgz+20210212-1+0~20210228.21+debian9~1.gbpf2b98f

--

php5.6-json:

  Installed: 5.6.40-47+0~20210227.51+debian9~1.gbpd522a2

--

php5.6-readline:

  Installed: 5.6.40-47+0~20210227.51+debian9~1.gbpd522a2

--

php7.0-json:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php5.6-common:

  Installed: 5.6.40-47+0~20210227.51+debian9~1.gbpd522a2

--

php7.0-mbstring:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php7.0-readline:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php7.0-xml:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php7.0-curl:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php-cli:

  Installed: 1:7.0+49

--

php-smbclient:

  Installed: 0.8.0-3

--

php5.6-cli:

  Installed: 5.6.40-47+0~20210227.51+debian9~1.gbpd522a2

--

php8.0-common:

  Installed: 8.0.3-1+0~20210305.17+debian9~1.gbp899a74

--

php7.0-soap:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

--

php-mysql:

  Installed: 1:7.0+49

--

php5.6-opcache:

  Installed: 5.6.40-47+0~20210227.51+debian9~1.gbpd522a2

--

php7.0-mysql:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

root@lamp ~# apt-cache policy libapache2-mod-php* | grep -v 'Installed: (none)' | grep 'Installed:' -B1

libapache2-mod-php:

  Installed: 1:7.0+49

--

libapache2-mod-php5.6:

  Installed: 5.6.40-47+0~20210227.51+debian9~1.gbpd522a2

--

libapache2-mod-php7.0:

  Installed: 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

root@lamp ~#

 

Dan's picture

Just wanted to add that I am currently using PHP Version 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9

Jeremy Davis's picture

Apologies that I'm a bit slow to respond. I've had my head down trying to finish up the v16.1 release, before I turn around and start work on getting v17.0 ready (Debian 11/Bullseye release is getting close and I'd really love to be ready to publish v17.0 soon after)...

Anyway, so as you suggested, the first thing I would recommend is removing that ini file you created. I.e.:

rm /etc/php/7.0/apache2/conf.d/20-smbclient.ini 

For future reference, when troubleshooting issues; as a general rule, I recommend always undoing any changes that don't fix the issue. Beyond reducing the chances of creating new issues, it also makes it easier to know what actually fixes the issue.

The next thing I would recommend is disabling the sury.org repo. It looks like you've followed best practice and put it in it's own file, so disabling it is super easy (just rename the file - only files with a '.list' file extension will be used by apt)...:

mv /etc/apt/sources.list.d/php5.list /etc/apt/sources.list.d/php5.list.disabled

It looks like you've got a hodgepodge of Debian and sury.org packages. It even looks like some of the PHP7.0 packages are from sury.org.

TBH, once you have the config setup, it possibly won't matter. But if you want to clean up before you try re-enabling the smbclient module, have a go at this:

apt clean
apt update
apt purge libapache2-mod-php5.6 php5.6 php5.6-json php5.6-readline php5.6-common \
     php5.6-cli php5.6-opcache ​php8.0-common
apt install -y --allow-downgrades \
    php7.0-cli=7.0.33-0+deb9u10 \
    php7.0-gd=7.0.33-0+deb9u10 \
    php7.0-opcache=7.0.33-0+deb9u10 \
    php-common=1:49 \
    php-pear=1:1.10.1+submodules+notgz-9+deb9u3 \
    php7.0-json=7.0.33-0+deb9u10 \
    php7.0-mbstring=7.0.33-0+deb9u10 \
    php7.0-readline=7.0.33-0+deb9u10 \
    php7.0-xml=7.0.33-0+deb9u10 \
    php7.0-curl=7.0.33-0+deb9u10 \
    php7.0-soap=7.0.33-0+deb9u10 \
    php7.0-mysql=7.0.33-0+deb9u10 \
    libapache2-mod-php7.0=7.0.33-0+deb9u10

Note that I just split them for easier reading. As I escaped the newlines (i.e. the '\' at the end of each line) means that you can still copy paste it into a CLI session.

That should ensure that you are running the Debian versions. I pulled the version strings from the Debian repos, but I'd recommend that you double check that you have the latest of all those. Try this:

apt update
apt list --upgradeable | grep php

You can safely ignore the warning that you'll see after the second line. If any packages show up there, then you could just run 'apt upgrade' (to upgrade everything) or to just update the explict php packages that show up, 'apt install PKG1 PKG2 ...'

According to the output you posted, you've definitely got the right version of php-smbclient installed, so you shouldn't need to do anything with that. Although you may need to manually enable it (FWIW generally just installing it should automatically enable it, but the file that you manually created probably got in the way). I.e.:

phpenmod smbclient

Hopefully that should work ok, but if not, you could try disabling it then re-enabling it:

phpdismod smbclient
phpenmod smbclient

Restarting Apache should make it so that's working now...

systemctl restart apache2

As you're probably aware, to test the enabled modules, you can create a info.php file like this (adjust WEBROOT as appropriate):

WEBROOT="/var/www"
cat > "$WEBROOT"/info.php 
EOF

Then browse to http://YOUR_SERVER/info.php and check that everything looks good...

Dan's picture

Well Im not sure exactly what state I have things in as I think something bad has happened with my installation.

I have been doing all of this on a development system that was created from a backup of our production system... with hopes of getting things to work on it before doing the same steps to production. Thereby not causing any issues with production that is still used every day, all day. 

Here is my current state of things on this development system.

My phpinfo output shows /etc/php/7.0/apache2/conf.d/20-smbclient.ini in the "additional .ini files parsed" section... but that is the only mention of smbclient on the entire output. I am hoping to see a section called smbclient like the V16 server has... but its just not there.

I am unable to login to webshell now on the system... its odd it brings up a login prompt but when I type in "root" it just says "Login incorrect" without ever asking me the password.  I am still able to log in via SSH... but I wanted to mention it in case it has something to do with something I did.

I did do a full upgrade of things when I started down this road and perhaps I allowed it to make a change to a config file.

Thank you SO So much for helping me out.  I am learning so much about Linux admin because of this. Since we are going to upgrade our production to V16 shortly... all of this knowledge may prove extremely valuable if things just dont go smoothly.

So....  any idea more ideas on why I am STILL unable to get smbclient enabled on my V15 dev system?

 

Jeremy Davis's picture

I'm a bit surprised that it isn't working yet... You've definitely restarted Apache right?!? (I'm pretty sure you did as otherwise the ini file shouldn't show up in the phpinfo - but just in case...).

Anyway, just to make sure that there isn't some weird bug that I am unaware of, I launched a fresh v15.1 LAMP myself, to see if it works for me (TL; DR it appears to...).

I did a clean install to a KVM VM. I then installed all updates (initially just the security updates, rebooted, then I ran 'apt upgrade' to install the remaining available updates). I then installed 'php-smbclient'. FWIW, here's the full output of the install:

root@lamp ~# apt install php-smbclient
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libdbus-1-3 libldb1 libsmbclient libtalloc2 libtdb1 libtevent0 libwbclient0 python-talloc samba-libs
Suggested packages:
  cups-common
Recommended packages:
  dbus
The following NEW packages will be installed:
  libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libdbus-1-3 libldb1 libsmbclient libtalloc2 libtdb1 libtevent0 libwbclient0 php-smbclient python-talloc samba-libs
0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 6494 kB of archives.
After this operation, 26.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.debian.org stretch/updates/main amd64 libldb1 amd64 2:1.1.27-1+deb9u2 [114 kB]
Get:2 http://deb.debian.org/debian stretch/main amd64 libtalloc2 amd64 2.1.8-1 [36.3 kB]
Get:3 http://deb.debian.org/debian stretch/main amd64 libtevent0 amd64 0.9.31-1 [29.3 kB]
Get:4 http://deb.debian.org/debian stretch/main amd64 libavahi-common-data amd64 0.6.32-2 [118 kB]
Get:5 http://security.debian.org stretch/updates/main amd64 libwbclient0 amd64 2:4.5.16+dfsg-1+deb9u3 [125 kB]
Get:6 http://security.debian.org stretch/updates/main amd64 samba-libs amd64 2:4.5.16+dfsg-1+deb9u3 [5235 kB]
Get:7 http://deb.debian.org/debian stretch/main amd64 libavahi-common3 amd64 0.6.32-2 [52.0 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 libdbus-1-3 amd64 1.10.32-0+deb9u1 [196 kB]
Get:9 http://deb.debian.org/debian stretch/main amd64 libavahi-client3 amd64 0.6.32-2 [55.3 kB]
Get:10 http://deb.debian.org/debian stretch/main amd64 libcups2 amd64 2.2.1-8+deb9u6 [307 kB]
Get:11 http://deb.debian.org/debian stretch/main amd64 libtdb1 amd64 1.3.11-2 [43.2 kB]
Get:12 http://deb.debian.org/debian stretch/main amd64 python-talloc amd64 2.1.8-1 [11.9 kB]
Get:13 http://security.debian.org stretch/updates/main amd64 libsmbclient amd64 2:4.5.16+dfsg-1+deb9u3 [152 kB]
Get:14 http://deb.debian.org/debian stretch/main amd64 php-smbclient amd64 0.8.0-3 [19.8 kB]
Fetched 6494 kB in 0s (11.9 MB/s)         
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libtalloc2:amd64.
(Reading database ... 37348 files and directories currently installed.)
Preparing to unpack .../00-libtalloc2_2.1.8-1_amd64.deb ...
Unpacking libtalloc2:amd64 (2.1.8-1) ...
Selecting previously unselected package libtevent0:amd64.
Preparing to unpack .../01-libtevent0_0.9.31-1_amd64.deb ...
Unpacking libtevent0:amd64 (0.9.31-1) ...
Selecting previously unselected package libavahi-common-data:amd64.
Preparing to unpack .../02-libavahi-common-data_0.6.32-2_amd64.deb ...
Unpacking libavahi-common-data:amd64 (0.6.32-2) ...
Selecting previously unselected package libavahi-common3:amd64.
Preparing to unpack .../03-libavahi-common3_0.6.32-2_amd64.deb ...
Unpacking libavahi-common3:amd64 (0.6.32-2) ...
Selecting previously unselected package libdbus-1-3:amd64.
Preparing to unpack .../04-libdbus-1-3_1.10.32-0+deb9u1_amd64.deb ...
Unpacking libdbus-1-3:amd64 (1.10.32-0+deb9u1) ...
Selecting previously unselected package libavahi-client3:amd64.
Preparing to unpack .../05-libavahi-client3_0.6.32-2_amd64.deb ...
Unpacking libavahi-client3:amd64 (0.6.32-2) ...
Selecting previously unselected package libcups2:amd64.
Preparing to unpack .../06-libcups2_2.2.1-8+deb9u6_amd64.deb ...
Unpacking libcups2:amd64 (2.2.1-8+deb9u6) ...
Selecting previously unselected package libtdb1:amd64.
Preparing to unpack .../07-libtdb1_1.3.11-2_amd64.deb ...
Unpacking libtdb1:amd64 (1.3.11-2) ...
Selecting previously unselected package libldb1:amd64.
Preparing to unpack .../08-libldb1_2%3a1.1.27-1+deb9u2_amd64.deb ...
Unpacking libldb1:amd64 (2:1.1.27-1+deb9u2) ...
Selecting previously unselected package libwbclient0:amd64.
Preparing to unpack .../09-libwbclient0_2%3a4.5.16+dfsg-1+deb9u3_amd64.deb ...
Unpacking libwbclient0:amd64 (2:4.5.16+dfsg-1+deb9u3) ...
Selecting previously unselected package python-talloc.
Preparing to unpack .../10-python-talloc_2.1.8-1_amd64.deb ...
Unpacking python-talloc (2.1.8-1) ...
Selecting previously unselected package samba-libs:amd64.
Preparing to unpack .../11-samba-libs_2%3a4.5.16+dfsg-1+deb9u3_amd64.deb ...
Unpacking samba-libs:amd64 (2:4.5.16+dfsg-1+deb9u3) ...
Selecting previously unselected package libsmbclient:amd64.
Preparing to unpack .../12-libsmbclient_2%3a4.5.16+dfsg-1+deb9u3_amd64.deb ...
Unpacking libsmbclient:amd64 (2:4.5.16+dfsg-1+deb9u3) ...
Selecting previously unselected package php-smbclient.
Preparing to unpack .../13-php-smbclient_0.8.0-3_amd64.deb ...
Unpacking php-smbclient (0.8.0-3) ...
Setting up libtdb1:amd64 (1.3.11-2) ...
Setting up libwbclient0:amd64 (2:4.5.16+dfsg-1+deb9u3) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libtalloc2:amd64 (2.1.8-1) ...
Setting up libdbus-1-3:amd64 (1.10.32-0+deb9u1) ...
Setting up libavahi-common-data:amd64 (0.6.32-2) ...
Setting up python-talloc (2.1.8-1) ...
Setting up libtevent0:amd64 (0.9.31-1) ...
Setting up libavahi-common3:amd64 (0.6.32-2) ...
Setting up libldb1:amd64 (2:1.1.27-1+deb9u2) ...
Setting up libavahi-client3:amd64 (0.6.32-2) ...
Setting up libcups2:amd64 (2.2.1-8+deb9u6) ...
Setting up samba-libs:amd64 (2:4.5.16+dfsg-1+deb9u3) ...
Setting up libsmbclient:amd64 (2:4.5.16+dfsg-1+deb9u3) ...
Setting up php-smbclient (0.8.0-3) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
[master 701a178] committing changes in /etc after apt run
 4 files changed, 4 insertions(+)
 create mode 120000 php/7.0/apache2/conf.d/20-smbclient.ini
 create mode 120000 php/7.0/cli/conf.d/20-smbclient.ini
 create mode 100644 php/7.0/mods-available/smbclient.ini
Counting objects: 1695, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (1064/1064), done.
Writing objects: 100% (1695/1695), done.
Total 1695 (delta 115), reused 1680 (delta 111)

I then restarted Apache, i.e.:

systemctl restart apache2

I then double-checked the phpinfo() (i.e. by default, browsed to http://MY_SERVER_IP/phpinfo.php). When I search (Ctlr-f} for 'smb' (no quotes) I get 7 hits (I only note left-hand section heading and smb related item from the right) :

* (Top/main table)
Additional .ini files parsed: /etc/php/7.0/apache2/conf.d/20-smbclient.ini
Registered PHP Streams: smb
* libsmbclient (completely new heading/table)
Version: 0.8.0
* smbclient (another completely new heading/table)
smbclient Support: enabled
smbclient extension Version: 0.8.0
libsmbclient library Version: 4.5.16-Debian

As for config, the changes within /etc/ are a new file /etc/php/7.0/mods-available/smbclient.ini and 2 new symlinks to that files. The contents of smbclient.ini file and demonstration of the symlinks:

root@lamp ~# cat /etc/php/7.0/mods-available/smbclient.ini
extension=smbclient.so
root@lamp ~# ls -la /etc/php/7.0/apache2/conf.d/20-smbclient.ini
lrwxrwxrwx 1 root root 41 Apr 21 02:46 /etc/php/7.0/apache2/conf.d/20-smbclient.ini -> /etc/php/7.0/mods-available/smbclient.ini
root@lamp ~# ls -la /etc/php/7.0/cli/conf.d/20-smbclient.ini    
lrwxrwxrwx 1 root root 41 Apr 21 02:46 /etc/php/7.0/cli/conf.d/20-smbclient.ini -> /etc/php/7.0/mods-available/smbclient.ini

I also double checked that the smbclient.so file exists:

root@lamp ~# find / -type f -name smbclient.so
/usr/lib/php/20151012/smbclient.so

If it's still not working for you, perhaps try removing it and then reinstalling it. I.e.:

apt purge --autoremove php-smbclient
apt install php-smbclient -y
systemctl restart apache2
Dan's picture

Its alive!  Aliiiiiiiiiive!    I now have a working smbclient in my V15 system.... AND a great education from the master.

Thank you thank you, THANK YOU!

That purge / autoremove thing did the trick!

 

Jeremy Davis's picture

Awesome! And thanks for your kind words...

FWIW, I'll add some explanation...

First 'apt purge' is shorthand for 'apt remove --purge' (or apt-get remove --purge). As is probably obvious, the 'remove' removes the package, the 'purge' (or '--purge') ensures that all config and data is also removed (by default config is kept).

The '--autoremove' switch is the same as running 'apt autoremove' (or 'apt-get autoremove') as a separate command. And what that does is remove any packages that are no longer required by the system (i.e. the dependencies of removed packages). The reason why there may be unrequired packages is that when you install a package, its dependencies are also installed. But when you uninstall/remove a package, it's dependencies are not removed by default.

When you use the '--autoremove' switch with the 'purge' command, the config and data of the dependencies are also removed.

So essentially what you just did was removed php-smbclient, all of it's dependencies and all of the config and data associated with all of those packages. Then with the 'apt install php-smbclient' you reinstalled them all and their clean associated data and config..! :)

Bottom line; there must have been some errant config, data and/or incorrect package(s) installed (from the previous install of the wrong php-smbclient package). Removing everything and reinstalling clean fixed that! :)

Zac's picture

root@nextcloud ~# uname -a
Linux nextcloud 5.15.107-2-pve #1 SMP PVE 5.15.107-2 (2023-05-10T09:10Z) x86_64 GNU/Linux
root@nextcloud ~# apt install php-smbclient
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package php-smbclient is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package 'php-smbclient' has no installation candidate
I am having an issue getting this installed, i recently installed the turnkey nextcloud container on proxmox and am unable to get all of my folder sync files to work in nextcloud because of this error in nextcloud "Malformed state response from server" 

Another message board for Ubuntu said it is related to smbclient however I am unable get it installed inside turnkey which is still very new to me.

Thank you 

Jeremy Davis's picture

php-smbclient is not packaged in Debian (hasn't been for some time - TBH I'm not sure why, but I'd assume bugs and/or other issues). According to the Nextcloud docs, whilst php-smbclient is preferred, Nextcloud should work with smbclient (which should definitely be install-able).

Add new comment