Apache 400 bad request, Unable to load dynamic library 'mbstring.so'

The apache error log shows:

[Tue Feb 13 09:53:19.292366 2018] [suexec:notice] [pid 13643:tid 140586989283072] AH01232: suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)

[Tue Feb 13 09:53:19.292473 2018] [:notice] [pid 13643:tid 140586989283072] ModSecurity for Apache/2.9.2 (http://www.modsecurity.org/) configured.

[Tue Feb 13 09:53:19.292479 2018] [:notice] [pid 13643:tid 140586989283072] ModSecurity: APR compiled version="1.6.3"; loaded version="1.6.3"

[Tue Feb 13 09:53:19.292483 2018] [:notice] [pid 13643:tid 140586989283072] ModSecurity: PCRE compiled version="8.41 "; loaded version="8.41 2017-07-05"

[Tue Feb 13 09:53:19.292487 2018] [:notice] [pid 13643:tid 140586989283072] ModSecurity: LIBXML compiled version="2.9.3"

[Tue Feb 13 09:53:19.292490 2018] [:notice] [pid 13643:tid 140586989283072] ModSecurity: Status engine is currently disabled, enable it by set SecStatusEngine to On.

[Tue Feb 13 09:53:19.358205 2018] [ssl:warn] [pid 13644:tid 140586989283072] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache] PHP Warning: PHP Startup: Unable to load dynamic library 'mbstring.so' (tried: /usr/local/php/lib/php/extensions/no-debug-zts-20170718/mbstring.so (/usr/local/php/lib/php/extensions/no-debug-zts-20170718/mbstring.so: cannot open shared object file: No such file or directory), /usr/local/php/lib/php/extensions/no-debug-zts-20170718/mbstring.so.so (/usr/local/php/lib/php/extensions/no-debug-zts-20170718/mbstring.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

[Tue Feb 13 09:53:19.383462 2018] [mpm_event:notice] [pid 13644:tid 140586989283072] AH00489: Apache/2.4.29 (Unix) OpenSSL/1.0.2g configured -- resuming normal operations [Tue Feb 13 09:53:19.383522 2018] [core:notice] [pid 13644:tid 140586989283072] AH00094: Command line: '/usr/local/apache/bin/httpd'

And when i type php -m

PHP Warning:  PHP Startup: Unable to load dynamic library 'mbstring.so' (tried: /usr/local/php/lib/php/extensions/no-debug-zts-20170718/mbstring.so (/usr/local/php/lib/php/extensions/no-debug-zts-20170718/mbstring.so: cannot open shared object file: No such file or directory), /usr/local/php/lib/php/extensions/no-debug-zts-20170718/mbstring.so.so (/usr/local/php/lib/php/extensions/no-debug-zts-20170718/mbstring.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
enchant
exif
fileinfo
filter
ftp
gd
gettext
gmagick
gmp
hash
iconv
imagick
imap
intl
json
ldap
libxml
mbstring
//more

As you can see there is mbstring among the list. And I also did sudo apt-get install php-mbstring. It updated nothing. My php version is 7.0.25, using Ubuntu 16.04 64 Bit. Can anyone know how to solve the problem?

2 answers

  • answered 2018-02-13 02:42 AKZhang

    Check if you have an empty "extension =" line in /usr/local/lib/php.ini file:

    grep extension /usr/local/lib/php.ini
    

    Basically, the extension line would have no content after the equals sign. If such a line does exist, comment out the empty extension line and restart Apache.

    Refer: cPanel forum

  • answered 2018-02-13 02:42 Gerik

    Whatever you're running is looking for a package that doesn't exist in the configured paths (mbstring.so means "mbstring shared object" which would be a linux library).

    It's not clear from your answer whether you actually have mbstring installed.

    You can try running the following to verify that you have what you need installed:

    $ sudo apt-cache search mbstring
    

    For me I get:

    php-mbstring - MBSTRING module for PHP [default]
    php-patchwork-utf8 - UTF-8 strings handling for PHP
    php-symfony-polyfill-mbstring - Symfony polyfill for the Mbstring extension
    php-symfony-polyfill-util - Symfony utilities for portability of PHP codes
    php7.1-mbstring - MBSTRING module for PHP
    

    Then try installing either of the mbstring packages and let us know what you get.