Article ID: 128800, created on May 4, 2016, last review on May 4, 2016

  • Applies to:
  • Operations Automation

Symptoms

We have installed and configured alt-php & resources as described in the guide http://download.pa.parallels.com/poa/5.5/doc/73005.htm.

Our resellers and customers complain that httpd error_log is seriously overloaded with messages like:

PHP Warning:  Module 'pdo_mysql' already loaded in Unknown on line 0
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'dom' already loaded in Unknown on line 0
PHP Warning:  Module 'dom' already loaded in Unknown on line 0

Cause

There are two ways to load most extensions in PHP. One is by compiling the extension directly into the PHP binary. The other is by loading a shared extension dynamically via ini file. The errors indicate that dynamic extensions are being loaded via .ini files, even though they are already compiled into the PHP binary.

Resolution

The solution is shown on the example of /opt/alt/php54/usr/bin/php binary:

  1. check php -v output for this version of PHP:

    # /opt/alt/php54/usr/bin/php -v
    PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/alt/php54/usr/lib64/php/modules/ffmpeg.so' - libswscale.so.2: cannot open shared object file:         No such file or directory in Unknown on line 0
    PHP Warning:  Module 'json' already loaded in Unknown on line 0
    PHP Warning:  Module 'sockets' already loaded in Unknown on line 0
    PHP Warning:  Module 'mbstring' already loaded in Unknown on line 0
    PHP Warning:  Module 'json' already loaded in Unknown on line 0
    ...
    PHP 5.4.45 (cli) (built: Sep  5 2015 07:39:54)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
        with eAccelerator v1.0-dev, Copyright (c) 2004-2012 eAccelerator, by eAccelerator
        with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com     (unconfigured) v5.0.18, Copyright (c) 2002-2015, by ionCube Ltd.
        with Zend OPcache v7.0.5, Copyright (c) 1999-2015, by Zend Technologies
        with SourceGuardian v10.1.3, Copyright (c) 2000-2014, by SourceGuardian Ltd.
        with XCache v2.0.1, Copyright (c) 2005-2012, by mOo
        with Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans
    
  2. above warnings means that all mentioned modules are already included into the binary file. It can be checked in the following way:

    # /opt/alt/php54/usr/bin/php -i | grep Configure
    ...
    Configure Command =>  './configure'  '--build=x86_64-redhat-linux-gnu'     '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix='     '--prefix=/opt/alt/php54' '--exec-prefix=/opt/alt/php54' '--bindir=/opt/alt/php54/usr/bin' '--sbindir=/opt/alt/php54/usr/sbin' '--sysconfdir=/opt/alt/php54/etc' '--datadir=/opt/alt/php54/usr/share' '--includedir=/opt/alt/php54/usr/include' '--libdir=/opt/alt/php54/usr/lib64' '--libexecdir=/opt/alt/php54/usr/libexec' '--localstatedir=/var' '--with-curl=/opt/alt/curlssl/usr' '--sharedstatedir=/usr/com' '--mandir=/opt/alt/php54/usr/share/man' '--infodir=/opt/alt/php54/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/opt/alt/php54/etc' '--with-config-file-scan-dir=/opt/alt/php54/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/opt/alt/t1lib/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/opt/alt/pcre/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-sysvmsg=shared' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--with-libxml-dir=/opt/alt/libxml2/usr' '--enable-xml' '--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr' '--enable-dbx=shared,/usr' '--with-recode=shared,/usr' '--with-enchant=shared,/usr' '--with-mhash' '--with-readline' '--with-mssql=shared,/opt/alt/freetds/usr' '--with-interbase=shared,/opt/alt/firebird/usr' '--with-pdo-firebird=shared,/opt/alt/firebird/usr' '--with-pdo-dblib=shared,/opt/alt/freetds/usr' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/opt/alt/sqlite/usr' '--enable-json=shared' '--enable-zip=shared' '--with-pspell=shared' '--enable-phar=shared' '--enable-posix=shared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--enable-intl=shared' '--with-icu-dir=/opt/alt/libicu/usr' '--enable-sqlite3=shared,/opt/alt/sqlite/usr'
    
  3. in order to remove such PHP Warnings it is necessary to comment the corresponding line in .ini file. For example, for PHP Warning: Module 'json' already loaded in Unknown on line 0 the line extension=json.so should be commented in the json.ini file:

    # cat /opt/alt/php54/etc/php.d/json.ini
    ; Enable json extension module
    ;extension=json.so
    

After that the warnings will disappear from logs. To get rid of all similar error messages, please repeat the steps for other modules and other versions of PHP as well.

Search Words

NG hosting php modules loaded several times

NG hosting php

Module 'PDO' already loaded in Unknown on line 0

Alt-PHP

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0

pdo_mysql

5356b422f65bdad1c3e9edca5d74a1ae caea8340e2d186a540518d08602aa065 e12cea1d47a3125d335d68e6d4e15e07

Email subscription for changes to this article
Save as PDF