Pi Hole fresh install Raspberry OS PHP fileinfo.so error

Hi there, long time reader, first time poster.

I just installed a great 32bit Raspberry Pi OS on my Pi 3 and ran the pinhole install script. Had to start again as I b0rked the previous install by power unplugging.

I'm seeing a PHP error:

$ pihole -up
  [✓] Update local cache of available packages
PHP Warning:  PHP Startup: Unable to load dynamic library 'fileinfo.so' (tried: /usr/lib/php/20190902/fileinfo.so (���: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/fileinfo.so.so (/usr/lib/php/20190902/fileinfo.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
  [i] Existing PHP installation detected : PHP version 7.4.28
PHP Warning:  PHP Startup: Unable to load dynamic library 'fileinfo.so' (tried: /usr/lib/php/20190902/fileinfo.so (���: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/fileinfo.so.so (/usr/lib/php/20190902/fileinfo.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'fileinfo.so' (tried: /usr/lib/php/20190902/fileinfo.so (���: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/fileinfo.so.so (/usr/lib/php/20190902/fileinfo.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
  [✓] Checking for git
  [✓] Checking for iproute2
  [✓] Checking for whiptail
  [✓] Checking for ca-certificates

  [i] Checking for updates...
  [i] Pi-hole Core:     up to date
  [i] Web Interface:    up to date
  [i] FTL:              up to date

  [✓] Everything is up to date!
$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'fileinfo.so' (tried: /usr/lib/php/20190902/fileinfo.so (���: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/fileinfo.so.so (/usr/lib/php/20190902/fileinfo.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.28 (cli) (built: Feb 17 2022 16:17:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies

The file exists:

$ sudo find / -name fileinfo.so
/usr/lib/php/20190902/fileinfo.so

Here's my pihole debug log

[✓] Your debug token is: https://tricorder.pi-hole.net/4poxMlYM/

Did you start again with a Pi-hole install, or did you flash an entirely new OS image first?

Started with a fresh image flash using the Raspberry Pi Imager, SSH'd in and did all the APT updates and then ran the Pi Hole installer script.

I have solved my own problem. This was done by removing all the PHP packages on my system and re-running the installer.

$ sudo apt-get remove php* -y

$ curl -sSL https://install.pi-hole.net | bash

$ php --version
PHP 7.4.28 (cli) (built: Feb 17 2022 16:17:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies

Looking at my bash history, I initially ran the installer with sudo, which may have caused the issue.

The installer otherwise would have re-called itself via sudo, so that was not the issue, but not required either.

Likely it was a corruption in one of the PHP packages/files. Assure that your PSU and power/USB cable have good quality and check dmesg -l emerg,alert,crit,err for potential voltage, filesystem or I/O errors.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.