PHP errors running update_daemon2.php

Describe the problem you’re having:

TL;DR version: after relocating to a new home and unpacking my server, my update_daemon2.php script won’t run. There seems to be a problem with mcrypt.so and/or a PHP/PDO driver. My linux skillset is not great, so this may be an easy fix but I may need a little hand-holding to get it done.

Long version: I’ve been running TT-RSS for a couple of years now as a replacement for Google Reader. I learned just enough linux to get it running on a Lubuntu virtual machine, and I’ve found that as long as I don’t touch that machine then it tends to work flawlessly. I recently moved to a new home and after getting the server up and running (after sitting in a box for a couple of weeks) I pulled up my TT-RSS page and found that the update daemon wasn’t running, according to the banner on the bottom of the page.

A quick web search showed there were potentially some issues after a recent TTRSS update, so after a complete system backup I reluctantly upgraded TT-RSS with a git pull, then updated Lubuntu and installed packages with apt-get upgrade (and the Lubuntu GUI software updater). I typically don’t like to do linux updates very often because it seems that there are often problems to fix afterwards. Anyway - this didn’t fix anything but it didn’t seem to break anything else.

systemctl shows that the ttrss-daemon.service loaded but failed to activate and run. Manually running php ./update_daemon2.php showed an error about being unable to locate mcrypt.so in /usr/local/lib/php/extensions/no-debug/non-zts-20151012, so I made a copy of mcrypt.so from /usr/lib/php/20151012 into that folder. Trying to run the daemon script again now shows a new error:

Exception while creating PDO object:could not find driver

Googling that error doesn’t bring much up, but there were some suggestions I followed about installing PHP-PDO packages, and of course that hasn’t fixed anything.

The fact that this occurred after having my server shut down for a couple of weeks is a little confusing, but I’m not much of a linux user so there may be something simple that I’ve overlooked. Any help would be much appreciated.

tt-rss version (including git commit id):

TT-RSS v17.12 (26a89ab)

Platform (i.e. Linux distro, PHP, PostgreSQL, etc) versions:

Ubuntu 16.04.4 LTS
PHP Version 7.0.29-1+ubuntu16.04.1+deb.sury.org+1 (PHP 7.1 seems to be present also)
MySQL Ver 14.14 Distrib 5.7.21

  1. mcrypt is deprecated, if not removed (depending on the version of PHP). If you had feeds that required authentication and you defined FEED_CRYPT_KEY in your config.php file you can use a PHP version that has the mcrypt extension installed and decrypt your keys (see the note in the config.php file) or just re-enter your credentials for each feed in question (probably easier than rolling back PHP versions if you don’t have many private feeds). Once done, set the key to an empty string.

  2. You need to install PHP’s PDO module. I don’t know how it’s named in other distros but apt-get install php-pdo works in Debian 9. Something like that should fix it. Restart the PHP process after installing, obviously.

  1. Okay, this is counter-intelligent. Operating system and application updates are provided for a reason. They fix bugs, they migrate data, they patch security vulnerabilities. I get that this system is running in your home and is probably not internet-facing, but still. The problem with only updating every once in a while (besides the obvious security implications) is that when you update and something breaks you have to start going back over 6+ months of changes to figure out what caused the issue. If you just stay up to date then the number of changes between updates is less and it’s easier to troubleshoot.

This is a fine note.

Just update your system. It you must, you can even use a LTR of $linux so you do not have to do many system wide updates…

Thanks for the replies.

Point taken about updating. I never claimed it was a wise idea to update infrequently, it was simply laziness/convenience/fear of breaking my little-understood Linux VM.

As for mcrypt, a couple of web searches did show me that it’s deprecated but I thought TT-RSS required it nonetheless. I don’t have any authenticated feeds, but I did have mcrypt referenced in my php.ini as an extension. I’ve now removed the reference from php.ini and I removed mcrypt.so from /usr/local/lib/php/extensions/no-debug/non-zts-20151012. While that seems to have cleared up any issues with mcrypt, I’m still getting the PDO error.

I tried installing php-pdo as a package, but was denied as apparently this is a virtual package that is included in php7.x-common (and that’s up-to-date). I’ve now updated PHP to Version 7.2.4-1+ubuntu16.04.1+deb.sury.org+1 with php7.2-common, then restarted everything, but I’m still not having any luck.

Do you have any other leads I can pursue to clear up this PDO error? I’m at my wit’s end.

sometimes i wonder why do we have a FAQ linked in big letters on tt-rss.org front page

one lead would be ubuntu forums

Virtual package is more or less an alias. It’s there so people can always just install php-pdo and get the vendor recommended/suggested version. In other words, it being a virtual package changes nothing; if the virtual package didn’t install, neither would the package(s) it references.

But I do wonder if it’s because of this:

Did you seriously just start deleting random files off the drive? Or did you actually use apt to properly remove/purge it? Because if you’re in the habit of just removing files on your own I think I understand why Linux updates have “problems to fix afterwards”, and why you’re having issues.

Even if you delete those files, the OS keeps track of which packages are installed (i.e. it still expects that package’s files to be there). If things go missing you’re going to experience unexpected results.

That being said, do what fox said and head over to an appropriate Linux forum to get support.

an ubuntu user, ladies and gentlemen

I note that the file he deleted was in /usr/local so it’s not even from a package. There’s no telling what state his system is in. The distribution doesn’t even matter at this point if he’s been installing this stuff by hand outside of what the Ubuntu repositories offer.

You may have read in my original message that I made a copy of mcrypt.so in that folder since the original error specifically mentioned it was missing there, so by removing it I was only undoing an earlier attempted fix. I don’t remove packages by manually deleting files.

As I continue to troubleshoot this problem, I noticed that the output of php -m includes a warning about being unable to load dynamic library pdo.so. I’m starting to reconfigure/rebuild PHP to hopefully remedy this.

Your constructive comments are appreciated. Derision from fox makes me feel warm and tingly. Seems to be a rite of passage here.

It is.

If I were in your position, it’d apt-get purge php* && apt-get autoremove and then start over. But that depends on what else is running on your system that may require PHP, so YMMV.

I’d also, personally, stick with PHP 7.0 or 7.1, but that’s your call.

The problem is becoming clearer. Apparently I should have installed PHP from a package, but I’ve been compiling from source. I’m partway through a new compile that I’ll try, but if that doesn’t work then I’ll set about removing the compiled PHP (unfortunately not easy, as there is no uninstall procedure so I’d be forced to manually remove) and replacing it with a package. Feel free to facepalm.

Looks like @AngryChris gets the prize. :slight_smile:

Good God, I’ve finally done it. I manually cleaned out all the previous source-based PHP files, purged all PHP packages, and then started fresh with the required packages, and now everything is hunky dory. Thanks JustAMacUser for pointing me in that direction.

https://wiki.debian.org/DontBreakDebian

read this

Got this error doing a (manual) server migration. I noticed, same as you, that php-pdo is already installed as part of php7-common. You also need a PDO backend driver for your database, and these are not in the default PHP install.

In my case (MySQL on Debian 9) the solution was apt-get install php-mysql.