0

I have a machine running Ubuntu 14.04.3 LTS that is deployed via Ansible. I've got PHP 7 installed using Ondřej Surý's PPA for PHP.

$ dpkg -l | grep -i php
ii  libapache2-mod-php7.0            7.0.3-2+deb.sury.org~trusty+1    amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php-common                       1:36+deb.sury.org~trusty+1       all          Common files for PHP packages
ii  php7.0                           7.0.4-6+deb.sury.org~trusty+1    all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.0-cli                       7.0.0-5+deb.sury.org~trusty+1    amd64        command-line interpreter for the PHP scripting language
ii  php7.0-common                    7.0.4-6+deb.sury.org~trusty+1    amd64        documentation, examples and common module for PHP
ii  php7.0-fpm                       7.0.4-6+deb.sury.org~trusty+1    amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.0-json                      7.0.0-5+deb.sury.org~trusty+1    amd64        JSON module for PHP
ii  php7.0-opcache                   7.0.0-5+deb.sury.org~trusty+1    amd64        Zend OpCache module for PHP
ii  php7.0-pgsql                     7.0.4-6+deb.sury.org~trusty+1    amd64        PostgreSQL module for PHP

The warnings

When cron runs /usr/lib/php/sessionclean, I get the following warnings:

PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'calendar' already loaded in Unknown on line 0
PHP Warning:  Module 'ctype' already loaded in Unknown on line 0
PHP Warning:  Module 'exif' already loaded in Unknown on line 0
PHP Warning:  Module 'fileinfo' already loaded in Unknown on line 0
PHP Warning:  Module 'ftp' already loaded in Unknown on line 0
PHP Warning:  Module 'gettext' already loaded in Unknown on line 0
PHP Warning:  Module 'iconv' already loaded in Unknown on line 0
PHP Warning:  Module 'Phar' already loaded in Unknown on line 0
PHP Warning:  Module 'posix' already loaded in Unknown on line 0
PHP Warning:  Module 'sockets' already loaded in Unknown on line 0
PHP Warning:  Module 'sysvmsg' already loaded in Unknown on line 0
PHP Warning:  Module 'sysvsem' already loaded in Unknown on line 0
PHP Warning:  Module 'sysvshm' already loaded in Unknown on line 0
PHP Warning:  Module 'tokenizer' already loaded in Unknown on line 0
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'calendar' already loaded in Unknown on line 0
PHP Warning:  Module 'ctype' already loaded in Unknown on line 0
PHP Warning:  Module 'exif' already loaded in Unknown on line 0
PHP Warning:  Module 'fileinfo' already loaded in Unknown on line 0
PHP Warning:  Module 'ftp' already loaded in Unknown on line 0
PHP Warning:  Module 'gettext' already loaded in Unknown on line 0
PHP Warning:  Module 'iconv' already loaded in Unknown on line 0
PHP Warning:  Module 'Phar' already loaded in Unknown on line 0
PHP Warning:  Module 'posix' already loaded in Unknown on line 0
PHP Warning:  Module 'sockets' already loaded in Unknown on line 0
PHP Warning:  Module 'sysvmsg' already loaded in Unknown on line 0
PHP Warning:  Module 'sysvsem' already loaded in Unknown on line 0
PHP Warning:  Module 'sysvshm' already loaded in Unknown on line 0
PHP Warning:  Module 'tokenizer' already loaded in Unknown on line 0
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'calendar' already loaded in Unknown on line 0

When running php -v I get a subset of those warnings:

PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'calendar' already loaded in Unknown on line 0
PHP Warning:  Module 'ctype' already loaded in Unknown on line 0
PHP Warning:  Module 'exif' already loaded in Unknown on line 0
PHP Warning:  Module 'fileinfo' already loaded in Unknown on line 0
PHP Warning:  Module 'ftp' already loaded in Unknown on line 0
PHP Warning:  Module 'gettext' already loaded in Unknown on line 0
PHP Warning:  Module 'iconv' already loaded in Unknown on line 0
PHP Warning:  Module 'Phar' already loaded in Unknown on line 0
PHP Warning:  Module 'posix' already loaded in Unknown on line 0
PHP Warning:  Module 'sockets' already loaded in Unknown on line 0
PHP Warning:  Module 'sysvmsg' already loaded in Unknown on line 0
PHP Warning:  Module 'sysvsem' already loaded in Unknown on line 0
PHP Warning:  Module 'sysvshm' already loaded in Unknown on line 0
PHP Warning:  Module 'tokenizer' already loaded in Unknown on line 0

And occasionally in the logs for CodeIgniter I get the line:

Severity: Core Warning --> Module 'tokenizer' already loaded Unknown 0

The config files

This error is not a new one so I've had plenty of other questions to look at, but the solution they suggest is to make sure there aren't any duplicate extension=... lines in my php.ini but there aren't any.

Here are all the files in /etc/php. There are a bunch of ini files for individual modules linked to in multiple places that are likely causing the issue.

/etc/php/mods-available/json.ini
/etc/php/mods-available/opcache.ini
/etc/php/7.0/fpm/php-fpm.conf
/etc/php/7.0/fpm/conf.d/* -> /etc/php/7.0/mods-available/*
/etc/php/7.0/fpm/pool.d
/etc/php/7.0/fpm/pool.d/www.conf
/etc/php/7.0/fpm/php.ini
/etc/php/7.0/cli/conf.d/* -> /etc/php/7.0/mods-available/*
/etc/php/7.0/cli/php.ini
/etc/php/7.0/apache2/php.ini.ucf-dist
/etc/php/7.0/apache2/conf.d/* -> /etc/php/7.0/mods-available/*
/etc/php/7.0/apache2/php.ini
/etc/php/7.0/mods-available/fileinfo.ini
/etc/php/7.0/mods-available/pdo_pgsql.ini
/etc/php/7.0/mods-available/sockets.ini
/etc/php/7.0/mods-available/exif.ini
/etc/php/7.0/mods-available/shmop.ini
/etc/php/7.0/mods-available/ctype.ini
/etc/php/7.0/mods-available/sysvshm.ini
/etc/php/7.0/mods-available/gettext.ini
/etc/php/7.0/mods-available/ftp.ini
/etc/php/7.0/mods-available/sysvmsg.ini
/etc/php/7.0/mods-available/calendar.ini
/etc/php/7.0/mods-available/iconv.ini
/etc/php/7.0/mods-available/pdo.ini
/etc/php/7.0/mods-available/phar.ini
/etc/php/7.0/mods-available/posix.ini
/etc/php/7.0/mods-available/tokenizer.ini
/etc/php/7.0/mods-available/pgsql.ini
/etc/php/7.0/mods-available/sysvsem.ini

Which of these files do I need to delete to stop the warnings without stopping PHP working (via web and CLI)? (bonus points if this is easily done via Ansible)

  • I have the same problem. And if I remove any of those ini files then the extension is not loaded at all. Did you finally figure out what the problem is? – nuqqsa Feb 7 '17 at 17:08
1

Try renaming the .ini files in /etc/php/7.0/mods-available/ to nameofthemodule.ini.back

Per example: sudo mv tokenizer.ini tokenizer.ini.back

Restart php, then check php -m and check if the warning for that module is gone.

It seems that when installing an extension the php-common is installed too, this install then makes new .ini files for the extensions included. But those extensions are already compiled in the php binary.

Process with caution, the above paragraph is just a guess.

  • Removing them all seems to do the trick, and nothing else appears to have broken. Any idea why php7.0-common installs those config files by default if they're built into the binary? Is there an easy way to get Ansible not to install them? – DanielGibbs Mar 18 '16 at 10:22
  • Whoops, spoke too soon. My web-app can't find PDO now :/ – DanielGibbs Mar 18 '16 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.