You are here
Dan - Wed, 2021/04/07 - 23:19
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:
Strange, my message is not here
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?
Sorry about the disappearing message...
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:
Hopefully that works?
If not, then please give me a little more info about the php-smbclient package you have installed. I.e.:
Also, if you haven't already, maybe the Apache logs (in /var/log/apache2) might include some useful info?
More Info
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
It looks like you have the 3rd party sury.org repo enabled
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
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:
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:
What a great learning opportunity!
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 ~#
My Active PHP Version
Just wanted to add that I am currently using PHP Version 7.0.33-47+0~20210228.54+debian9~1.gbp7f60a9
Sorry for slow response...
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.:
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)...:
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:
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:
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.:
Hopefully that should work ok, but if not, you could try disabling it then re-enabling it:
Restarting Apache should make it so that's working now...
As you're probably aware, to test the enabled modules, you can create a info.php file like this (adjust WEBROOT as appropriate):
Then browse to http://YOUR_SERVER/info.php and check that everything looks good...
No dice....
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?
What?! Ok, I just launched a v15.1 LAMP...
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:
I then restarted Apache, i.e.:
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) :
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:
I also double checked that the smbclient.so file exists:
If it's still not working for you, perhaps try removing it and then reinstalling it. I.e.:
Who's the one with the mad skillz? JD! He's got the mad skillz!
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!
Woohoo! :)
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! :)
root@nextcloud ~# uname -a
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
php-smbclient is not packaged; NC should work with smbclient
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