Dan's picture
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

Add new comment