Table of contents

PHP configure error Package requirements (oniguruma) were not met

PHP May 30, 2020 Viewed 17.4K Comments 0

Question

On Linux/Mac systems, using PHP 7.4.6 to call mb_convert_encoding will cause a fatal error.

Error	Uncaught Error: Call to undefined function mb_convert_encoding() in /develop/php/ZolAction.php:22

When compiling php-7.4.6 on Linux, run the command ./configure --prefix=/opt/php-7.4.6 --with-pdo-mysql --enable-fpm --with-curl --with-zip --enable-mbstring, but the following error occurs.

checking for oniguruma... no
configure: error: Package requirements (oniguruma) were not met:

No package 'oniguruma' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ONIG_CFLAGS
and ONIG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Solution

  • Mac OS
brew install oniguruma
  • Ubuntu/Debian

On the web page https://pkgs.org/download/libonig-dev, find the libonig-dev version that matches your operating system, download and install it.

Or with apt-get command as follow.

sudo apt-get install libonig-dev
  • RHEL/CentOS <= 7

On the web page https://pkgs.org/search/?q=oniguruma, find the oniguruma-devel version that matches your operating system, download and install it.

Or with yum command as follow.

sudo yum install oniguruma-devel
  • RHEL/CentOS 8

In Centos 8, there is no oniguruma-devel on the official CentOS x86_64 repository, you can download oniguruma-6.8.2-0.1.el8.remi.x86_64.rpm and oniguruma-devel-6.8.2-0.1.el8.remi.x86_64.rpm from Remi x86_64 repository on the website https://pkgs.org/search/?q=oniguruma. Run the installation command:

$ sudo yum install ./oniguruma-6.8.2-0.1.el8.remi.x86_64.rpm
$ sudo yum install ./oniguruma-devel-6.8.2-0.1.el8.remi.x86_64.rpm
Updated Jul 01, 2020