jailkit: php-cli + mysql problems with mysql.so + libmysqlclient.so.18

Discussion in 'Installation/Configuration' started by ItsDom, Jun 11, 2013.

  1. ItsDom

    ItsDom New Member

    Hi,

    I'm having problems getting PHP-CLI working in jailkit. Running CentOS 6.4, followed setup guide from http://www.howtoforge.com/perfect-server-centos-6.4-x86_64-nginx-dovecot-ispconfig-3

    My end goal is for a jailkit shell user to be able to install composer themselves.

    There error I'm getting is this:

    Code:
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.18: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so' - libmysqlclient.so.18: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_mysql.so' - libmysqlclient.so.18: cannot open shared object file: No such file or directory in Unknown on line 0
    
    ls -l /usr/lib64/php/modules/ | grep mysql (in jailkit by web user):
    Code:
    -rwxr-xr-x 1 root root   53800 Jun  5 15:43 mysql.so
    -rwxr-xr-x 1 root root  139864 Jun  5 15:43 mysqli.so
    -rwxr-xr-x 1 root root   30304 Jun  5 15:43 pdo_mysql.so
    
    ls -l /usr/lib64/mysql/ | grep mysql (in jailkit by web user):
    Code:
    lrwxrwxrwx 1 root root      24 Jun 11 14:26 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
    -rwxr-xr-x 1 root root 2156904 Dec 23  2010 libmysqlclient.so.16.0.0
    lrwxrwxrwx 1 root root      24 Jun 11 14:26 libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
    -rwxr-xr-x 1 root root 2987552 Apr 18 14:49 libmysqlclient.so.18.0.0
    lrwxrwxrwx 1 root root      26 Jun 11 14:26 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
    -rwxr-xr-x 1 root root 2165216 Dec 23  2010 libmysqlclient_r.so.16.0.0
    -rwxr-xr-x 1 root root    7090 Apr 18 14:49 mysql_config
    -rwxr-xr-x 1 root root   11936 Apr 18 14:33 mysqlbug
    

    jk_init.ini relevant part (perl/pear stuff is for phar to be unpack phar files):
    Code:
    [php_cli_mysql]
    comment = PHP and other bits for PHP cli
    executables = /usr/bin/php, /usr/bin/perl, /usr/bin/phar.phar, /usr/bin/phar, /usr/bin/mysql
    directories = /usr/share/pear, /usr/share/php, /etc/php.d
    libraries = /usr/lib64/php-zts/modules/*, /usr/lib64/php/modules/*, /usr/lib64/mysql/*
    regularfiles= /etc/php.ini
    

    php --ini as root (e.g. not in jailkit):
    Code:
    Configuration File (php.ini) Path: /etc
    Loaded Configuration File:         /etc/php.ini
    Scan for additional .ini files in: /etc/php.d
    Additional .ini files parsed:      /etc/php.d/apc.ini,
    /etc/php.d/curl.ini,
    /etc/php.d/dom.ini,
    /etc/php.d/fileinfo.ini,
    /etc/php.d/gd.ini,
    /etc/php.d/imap.ini,
    /etc/php.d/json.ini,
    /etc/php.d/ldap.ini,
    /etc/php.d/magickwand.ini,
    /etc/php.d/mbstring.ini,
    /etc/php.d/mcrypt.ini,
    /etc/php.d/mssql.ini,
    /etc/php.d/mysql.ini,
    /etc/php.d/mysqli.ini,
    /etc/php.d/odbc.ini,
    /etc/php.d/pdo.ini,
    /etc/php.d/pdo_dblib.ini,
    /etc/php.d/pdo_mysql.ini,
    /etc/php.d/pdo_odbc.ini,
    /etc/php.d/pdo_sqlite.ini,
    /etc/php.d/phar.ini,
    /etc/php.d/shout.ini,
    /etc/php.d/snmp.ini,
    /etc/php.d/soap.ini,
    /etc/php.d/sqlite3.ini,
    /etc/php.d/tidy.ini,
    /etc/php.d/wddx.ini,
    /etc/php.d/xmlreader.ini,
    /etc/php.d/xmlrpc.ini,
    /etc/php.d/xmlwriter.ini,
    /etc/php.d/xsl.ini,
    /etc/php.d/zip.ini
    
    php --ini run in jailkit as web user:
    Code:
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.18: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so' - libmysqlclient.so.18: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_mysql.so' - libmysqlclient.so.18: cannot open shared object file: No such file or directory in Unknown on line 0
    No log handling enabled - turning on stderr logging
    Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
    Cannot find module (HOST-RESOURCES-TYPES): At line 0 in (none)
    Cannot find module (UCD-DISKIO-MIB): At line 0 in (none)
    Cannot find module (TCP-MIB): At line 0 in (none)
    Cannot find module (UDP-MIB): At line 0 in (none)
    Cannot find module (MTA-MIB): At line 0 in (none)
    Cannot find module (NETWORK-SERVICES-MIB): At line 0 in (none)
    Cannot find module (SCTP-MIB): At line 0 in (none)
    Cannot find module (RMON-MIB): At line 0 in (none)
    Cannot find module (EtherLike-MIB): At line 0 in (none)
    Cannot find module (LM-SENSORS-MIB): At line 0 in (none)
    Cannot find module (IP-MIB): At line 0 in (none)
    Cannot find module (IF-MIB): At line 0 in (none)
    Cannot find module (SNMPv2-MIB): At line 0 in (none)
    Cannot find module (SNMPv2-SMI): At line 0 in (none)
    Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
    Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
    Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
    Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
    Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
    Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
    Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)
    Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
    Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
    Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
    Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
    Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
    Cannot find module (IPV6-ICMP-MIB): At line 0 in (none)
    Cannot find module (IPV6-MIB): At line 0 in (none)
    Cannot find module (IPV6-TCP-MIB): At line 0 in (none)
    Cannot find module (IPV6-UDP-MIB): At line 0 in (none)
    Cannot find module (IP-FORWARD-MIB): At line 0 in (none)
    Cannot find module (NET-SNMP-PASS-MIB): At line 0 in (none)
    Cannot find module (NET-SNMP-EXTEND-MIB): At line 0 in (none)
    Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
    Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
    Cannot find module (SNMPv2-TM): At line 0 in (none)
    Cannot find module (NET-SNMP-VACM-MIB): At line 0 in (none)
    Configuration File (php.ini) Path: /etc
    Loaded Configuration File:         /etc/php.ini
    Scan for additional .ini files in: /etc/php.d
    Additional .ini files parsed:      /etc/php.d/apc.ini,
    /etc/php.d/curl.ini,
    /etc/php.d/dom.ini,
    /etc/php.d/fileinfo.ini,
    /etc/php.d/gd.ini,
    /etc/php.d/imap.ini,
    /etc/php.d/json.ini,
    /etc/php.d/ldap.ini,
    /etc/php.d/magickwand.ini,
    /etc/php.d/mbstring.ini,
    /etc/php.d/mcrypt.ini,
    /etc/php.d/mssql.ini,
    /etc/php.d/mysql.ini,
    /etc/php.d/mysqli.ini,
    /etc/php.d/odbc.ini,
    /etc/php.d/pdo.ini,
    /etc/php.d/pdo_dblib.ini,
    /etc/php.d/pdo_mysql.ini,
    /etc/php.d/pdo_odbc.ini,
    /etc/php.d/pdo_sqlite.ini,
    /etc/php.d/phar.ini,
    /etc/php.d/shout.ini,
    /etc/php.d/snmp.ini,
    /etc/php.d/soap.ini,
    /etc/php.d/sqlite3.ini,
    /etc/php.d/tidy.ini,
    /etc/php.d/wddx.ini,
    /etc/php.d/xmlreader.ini,
    /etc/php.d/xmlrpc.ini,
    /etc/php.d/xmlwriter.ini,
    /etc/php.d/xsl.ini,
    /etc/php.d/zip.ini
    
    As you can see, the files are all there, it works fine outside the jail. Any ideas?

    Thanks in advanced
     
    Last edited: Jun 11, 2013
  2. ItsDom

    ItsDom New Member

    Still no takers?

    The purpose of me trying to get jailkit working is so that I can allow convenient use of CMS' which have a command line element (e.g. Laravel, CakePHP etc.) I've now got Jailkit working, got Git working in the jail and got php-cli half working in the jail (enough to extract and handle phar files) but I feel I'm now stuck at the final hurdle.

    Is it possible to achieve what I'm looking for with ISPConfig?
     
  3. ItsDom

    ItsDom New Member

    Okay. Is there any way to raise this as a bug in ISPConfig.

    Instead of overcomplicating thinks and doing the jk_init.ini stuff myself, I tried just adding the php and mysql binaries to the chroot apps list in ISPConfig. Still the same issue.

    The problem seems to be with extensions. If I remove loading of all the extensions (remove everything from /etc/php.d in the jail) then the error messages go away, but nothing really works.....

    I've tried a full fresh reinstall following http://www.howtoforge.com/perfect-server-centos-6.4-x86_64-nginx-dovecot-ispconfig-3 with no modifications, and still have the same problem.

    I'm not sure "bug in ISPConfig" is the right terminology to use, but ultimately a feature in ISPConfig doesn't work fully in combination with one of the recommended guides.

    Perhaps a note on this should be added to the guide - something along the lines of "Note: in the setup described in this guide, using the 'Jailkit chrooted applications' field to enable php-cli with mysql in Jailkit will NOT work."

    Could someone please test this on another setup to ensure it's not just me please?
     
  4. ItsDom

    ItsDom New Member

    I have nothing to lose by bumping this.
     
  5. TFrank

    TFrank New Member

    Hello,

    quite old post, but this message is caused by missing library configuration. You have to add following paths to you jk_init.ini file:
    • CentOS 6
      /etc/ld.so.conf.d/mysql-x86_64.conf
    • CentOS 7
      /etc/ld.so.conf.d/mariadb-x86_64.conf
    untested in CentOS 6, but works in CentOS 7
    Best Regards
     
    till likes this.

Share This Page