install redis for php 8.1 8.2 configure: error: C preprocessor "/lib/cpp" fails sanity check

Author: Anonymous Publish Time: 2024.07.25 15:12:22

configure: error: in `/var/tmp/pear-build-rootw5cIJm/redis-6.0.2':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

 

the most esay way to install php redis is dnf/yum but it's not avaible for centos stream 9

so we use source code or pecl

pecl install redis
PHP Warning:  PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib64/php/modules/redis.so (/usr/lib64/php/modules/redis.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/redis.so.so (/usr/lib64/php/modules/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading redis-6.0.2.tgz ...
Starting to download redis-6.0.2.tgz (365,966 bytes)
..........................................................................done: 365,966 bytes
43 source files, building
running: phpize
Configuring for:
PHP Api Version:         20220829
Zend Module Api No:      20220829
Zend Extension Api No:   420220829
enable igbinary serializer support? [no] :
enable lzf compression support? [no] :
enable zstd compression support? [no] :
enable msgpack serializer support? [no] :
enable lz4 compression? [no] :
use system liblz4? [yes] :
building in /var/tmp/pear-build-rootw5cIJm/redis-6.0.2
running: /var/tmp/redis/configure --with-php-config=/usr/bin/php-config --enable-redis-igbinary=no --enable-redis-lzf=no --enable-redis-zstd=no --enable-redis-msgpack=no --enable-redis-lz4=no --with-liblz4
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/var/tmp/pear-build-rootw5cIJm/redis-6.0.2':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
ERROR: `/var/tmp/redis/configure --with-php-config=/usr/bin/php-config --enable-redis-igbinary=no --enable-redis-lzf=no --enable-redis-zstd=no --enable-redis-msgpack=no --enable-redis-lz4=no --with-liblz4' failed

 

how to fix this  

finally i got the answer ,

you should install 

dnf install kernel-headers

Comment

No Comments