PHP7.4.11版本安装

环境

Centos7 + PHP-7.4.11

命令

./configure --prefix=/data/server/php \
--disable-cgi \
--enable-mbstring \
--enable-bcmath \
--enable-sockets \
--with-openssl \
--enable-pcntl \

此版本的 mbstring 扩展,依赖了[oniguruma]

安装时,会报错如下

  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.

解决:

wget https://github.com/kkos/oniguruma/archive/v6.9.5.zip
mv v6.9.5.zip oniguruma-6.9.5.zip
unzip oniguruma-6.9.5.zip
autoreconf -vfi (* case: configure script is not found.)
# --libdir=/lib64/ 这个在64位系统,好像必需配置,不配置,在编译PHP的时候会报错
./configure --prefix=/data/server/oniguruma --libdir=/lib64/
make
make install

报错如下:

# 报错信息如下:
# ext/mbstring/mbstring.o: In function `_php_mb_free_regex':
# /data/source/php-7.4.11/ext/mbstring/mbstring.c:1048: undefined reference to `onig_free'
# /data/source/php-7.4.11/ext/mbstring/mbstring.c:1048: undefined reference to `onig_free'
# 报错: 
# 虽然配置两个环境变量【ONIG_CFLAGS|ONIG_LIBS】解决了./configure的问题,但make却没通过:
  /data/source/php-7.4.11/ext/mbstring/mbstring.c:61:24: fatal error: oniguruma.h: No such file or directory
   # include <oniguruma.h>
                          ^
  compilation terminated.
  make: *** [ext/mbstring/mbstring.lo] Error 1

分类: