configure: error: Please reinstall the libmagic distribution
configure: error: Please reinstall the libmagic distribution
Solution
You need this https://pecl.php.net/package/imagick
yum-based distributions
# yum install file
# yum install file-devel
Install from source
$ wget https://pecl.php.net/get/imagick-3.4.4.tgz
$ tar -xzvf imagick-3.4.4.tgz
$ cd imagick-3.4.4/
$ phpize (or in my case /usr/local/php-7.4.12/bin/phpize)
$ ./configure --with-php-config=/usr/local/php-7.4.12/bin/php-config
(...) lots of successful stuff
checking ImageMagick MagickWand API configuration program... checking Testing /usr/local/bin/MagickWand-config... Doesn't exist
checking Testing /usr/bin/MagickWand-config... Doesn't exist
checking Testing /usr/sbin/bin/MagickWand-config... Doesn't exist
checking Testing /opt/bin/MagickWand-config... Doesn't exist
checking Testing /opt/local/bin/MagickWand-config... Doesn't exist
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
$ apt install graphicsmagick libmagickwand-dev
Even with that, same error !
(...)
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local/php-7.4.12
checking for PHP includes... -I/usr/local/php-7.4.12/include/php -I/usr/local/php-7.4.12/include/php/main -I/usr/local/php-7.4.12/include/php/TSRM -I/usr/local/php-7.4.12/include/php/Zend -I/usr/local/php-7.4.12/include/php/ext -I/usr/local/php-7.4.12/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php-7.4.12/lib/php/extensions/no-debug-non-zts-20190902
checking for PHP installed headers prefix... /usr/local/php-7.4.12/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking for fileinfo support... yes, shared
checking for magic files in default path... not found
configure: error: Please reinstall the libmagic distribution
$ apt install libmagic-dev
Bingo !
(...)
creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
~/Fileinfo-1.0.4#
then continue with
$ make
$ make install
Oups!! Celebrated too soon, the compilation throws a lot of errors
/root/Fileinfo-1.0.4/fileinfo.c:195:50: error: ‘finfo_resource_destructor’ undeclared (first use in this function); did you mean ‘list_entry_destructor’?
/usr/local/php-7.4.12/include/php/main/php_globals.h:31:29: error: ‘struct _php_core_globals’ has no member named ‘safe_mode’
# define PG(v) (core_globals.v)
(...)
/root/Fileinfo-1.0.4/fileinfo.c:421:3: error: ‘RETURN_STRING’ undeclared (first use in this function); did you mean ‘TOK_STRING’?
RETURN_STRING(ret_val, 1);
^~~~~~~~~~~~~
TOK_STRING
Solution
Build from your php source directory, not from the package downloaded from PECL website
$ find / -name fileinfo
/root/compile-php-debian/php-src/ext/fileinfo
$ cd /root/compile-php-debian/php-src/ext/fileinfo
$ ./configure --with-php-config=/usr/local/php-7.4.12/bin/php-config
$ make
$ make install
Installing shared extensions: /usr/local/php-7.4.12/lib/php/extensions/no-debug-non-zts-20190902/
Thanks to dongfangweiyu in https://segmentfault.com/q/1010000006625915
However, PHP still doesn't run, continued in
Recent Comments