【宅技术】阿里云centos7.6安装php7.3中遇到的错误及解决方案

发布于 2019-10-11  8.64k 次阅读


0x001 前言

在Centos7.6安装php7.3中遇到了很多很多前所未有的问题,于是我通过百度整理一下常见问题,及处理方案,如有不对,请留言指示!感谢!

0x002 问题及处理方案

(1)、解决configure: WARNING: You will need re2c 0.13.4 or later

configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.、

解决方案

wget https://sourceforge.net/projects/re2c/files/0.16/re2c-0.16.tar.gz
tar zxf re2c-0.16.tar.gz && cd re2c-0.16
./configure
make && make install

(2)、解决找不到 zipconf.h

/usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or dire

解决方案

#解决方法:手动复制过去
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h

(3)、编译错误,解决依赖

configure: error: libxml2 not found. Please check your libxml2 installation.

1yum install -y  libxml2-devel

configure: error: Please reinstall the BZip2 distribution

1yum install -y  bzip2-devel

configure: error: cURL version 7.15.5 or later is required to compile php with cURL support

1yum install -y  curl-devel

configure: error: jpeglib.h not found.

1yum install -y  libjpeg-devel

configure: error: png.h not found.

1yum install -y libpng-devel

configure: error: freetype-config not found.

1yum install -y freetype-devel

configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

1yum install -y libxslt-devel

configure: error: Please reinstall the libzip distribution

1yum install -y libzip-devel

checking for libzip... configure: error: system libzip must be upgraded to version >= 0.11

#先删除旧版本yum remove -y libzip #下载编译安装wget https://nih.at/libzip/libzip-1.2.0.tar.gztar -zxvf libzip-1.2.0.tar.gzcd libzip-1.2.0./configuremake && make install

off_t undefined 报错

checking libzip... yeschecking for the location of zlib... /usrchecking for pkg-config... (cached) /usr/bin/pkg-configchecking for libzip... in default path: found in /usr/localchecking for zip_open in -lzip... yeschecking for zip_file_set_encryption in -lzip... yeschecking for zip_libzip_version in -lzip... nochecking stdbool.h usability... yeschecking stdbool.h presence... yeschecking for stdbool.h... yeschecking fts.h usability... yeschecking fts.h presence... yeschecking for fts.h... yeschecking for int8_t... (cached) yeschecking for int16_t... (cached) yeschecking for int32_t... (cached) yeschecking for int64_t... (cached) yeschecking for uint8_t... (cached) yeschecking for uint16_t... (cached) yeschecking for uint32_t... (cached) yeschecking for uint64_t... (cached) yeschecking for ssize_t... yeschecking size of short... (cached) 2checking size of int... (cached) 4checking size of long... (cached) 8checking size of long long... (cached) 8checking size of off_t... 0configure: error: off_t undefined; check your library configuration

off_t 类型是在 头文件 unistd.h中定义的,
在32位系统 编程成 long int ,64位系统则编译成 long long int ,
在进行编译的时候 是默认查找64位的动态链接库,
但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf里并没有加入搜索路径,
这个时候需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。

#添加搜索路径到配置文件
echo '/usr/local/lib64/usr/local/lib/usr/lib/usr/lib64'>>
/etc/ld.so.conf 
#然后 更新配置ldconfig -v

安装过程中报错

1make && make install

报错
usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or directory

1cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h

(4)、PHP7.3缺少ZIP

cd /www/server/php/73/src/ext/zip/
/www/server/php/73/bin/phpize
./configure --with-php-config=/www/server/php/73/bin/php-config
make && make install

然后,把以前从PHP配置文件里删去的第 1298 行加回来,即在配置文件中加回以下文字:

extension = zip.so

(5)、PHP最大表单提交限制max_input_vars

在php.ini里搜索 max_input_vars ,

就直接更改 max_input_vars ,例如: max_input_vars = 5000,


Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/www.zhaiike.com/wp-content/plugins/wechat-social-login/templates/share/share-bar.php on line 7

郑州90后一名计算机爱好者,希望能通过网络结交更多朋友!