Reputation: 14532
Just noticed, that PHP throws warnings, when executed on the CLI:
php module is already loaded
$ php -v
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 'shmop' already loaded in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/sockets.so' - /usr/lib/php/20151012/sockets.so: undefined symbol: php_network_gethostbyname 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 7.0.3-5+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.0RC4, Copyright (c) 2002-2016, by Derick Rethans
I know, how to prevent them -- simply remove extension={extname}.so
from the /etc/php/7.0/cli/conf.d/{extname}.ini
files. But:
Is removing of this line in the INI files a solution or just a workaround to avoid the warning messages? Can any side effects occur due to this? Why does it happen / What is the issue actually caused by?
Upvotes: 7
Views: 48965
Reputation: 35
just a piece of hint for those people who landed on this page.
Upvotes: 0
Reputation: 3166
This happened to me when I installed the php-mbstring
using sudo apt-get install php-mbstring
and enabled extension=mbstring
in my php.ini
.
PHP look at two mbstring
plugin. One in installed package, second in enabled package in php.ini
The solution is to disable the plugins in php.ini
;extension=bz2
;extension=curl
;extension=fileinfo
;extension=gd2
;extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=interbase
;extension=ldap
;extension=mbstring
Upvotes: 4
Reputation: 1
I had the same problem. I have updated my PHP Version and cleared off the issue.
For some reason, the problem originated because of an incoherent status of the composer.lock
file. After a composer update (and of course running all my unit-tests to ensure nothing was broken), the error was gone and the composer run was clean.
Upvotes: 0
Reputation: 1291
PHP on Linux usually scans subfolders for more configuration files, which is what happened in this case.
Configuration File (php.ini) Path => /etc/php/7.0/cli Loaded
Configuration File => /etc/php/7.0/cli/php.ini Scan this dir for additional .ini files => /etc/php/7.0/cli/conf.d
Additional .ini files parsed =>
/etc/php/7.0/cli/conf.d/10-opcache.ini,
/etc/php/7.0/cli/conf.d/10-pdo.ini,
/etc/php/7.0/cli/conf.d/20-calendar.ini,
/etc/php/7.0/cli/conf.d/20-ctype.ini,
/etc/php/7.0/cli/conf.d/20-curl.ini,
/etc/php/7.0/cli/conf.d/20-exif.ini,
/etc/php/7.0/cli/conf.d/20-fileinfo.ini,
/etc/php/7.0/cli/conf.d/20-ftp.ini,
/etc/php/7.0/cli/conf.d/20-gettext.ini,
/etc/php/7.0/cli/conf.d/20-iconv.ini,
/etc/php/7.0/cli/conf.d/20-json.ini,
/etc/php/7.0/cli/conf.d/20-mcrypt.ini,
/etc/php/7.0/cli/conf.d/20-mongodb.ini,
/etc/php/7.0/cli/conf.d/20-mysqli.ini,
/etc/php/7.0/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.0/cli/conf.d/20-pdo_sqlite.ini,
/etc/php/7.0/cli/conf.d/20-phar.ini,
/etc/php/7.0/cli/conf.d/20-posix.ini,
/etc/php/7.0/cli/conf.d/20-readline.ini,
/etc/php/7.0/cli/conf.d/20-shmop.ini,
/etc/php/7.0/cli/conf.d/20-sockets.ini,
/etc/php/7.0/cli/conf.d/20-sqlite3.ini,
/etc/php/7.0/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.0/cli/conf.d/20-sysvsem.ini,
/etc/php/7.0/cli/conf.d/20-sysvshm.ini,
/etc/php/7.0/cli/conf.d/20-tokenizer.ini,
/etc/php/7.0/cli/conf.d/20-xdebug.ini,
/etc/php/7.0/cli/conf.d/20-xsl.ini
Little walk through PHP scanned the folder /etc/php/7.0/cli/
and found a php.ini
which told it there should be more configuration (ini) files in a subdirectory called conf.d
and each module has its own ini file typically on Linux and in the later version of PHP.
To answer the question "Is removing of this line in the INI files a solution or just a workaround to avoid the warning messages?"
Honestly I like having the configuration for each module in a separate file, but you could remove the files in conf.d
if you wish to configure the module in the php.ini
file. I just find that it gets cluttered.
Upvotes: 5
Reputation: 1479
You have probably loaded the shown extensions twice in your php.ini files.
You can search the folder /etc/php/7.0 where you will find php.ini files in its subfolders, most probably in :
If you see some extension=something.so repeated twice in these php.ini files you can remove it from one or if still the warning shows remove from both.
Upvotes: 8
Reputation: 1
Check /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini. You should not load in each php.ini in this directories the extension xdebug.so. Only one php.ini should load it. PHP Warning: Module already loaded in Unknown on line 0
Upvotes: 0
Reputation: 40896
PHP is loading modules multiple times. Find and remove the extra php.ini
file(s).
.
<?php
phpinfo();
php.ini
is located. Go on disk and rename it php.ini.bak
. php.ini
is located. That's the duplicate. Upvotes: 3