centos 下 php8.1安装

安装过程和php7 没有什么两样
解压命令是 jar -zxvf 源文件包 会自动解压到当前目录

就是报了一个错误:

make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

解决办法也很简单,因为是运行内存不足,关闭一些运行内存即可。
如果物理内存过小,在configure 中添加一个--disable-fileinfo,虽然解决了,但禁用显然会带来很多问题。

更新:
部分应用会用到 sodium , 需要 安装libsodium: yum install libsoium-devel 然后在 configure 中加入 -with-sodium
composer 会需要 zip , 安装:yum install -y unzip zip

使用软连接更改 系统php : ln -snf /phath/to/php8.19/php /usr/bin/php

命令行参数:
./configure --prefix=/abc/server/php81 --with-config-file-path=/abc/server/php81/etc --with-config-file-scan-dir=/abc/server/php81/etc/php.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-sockets --enable-soap --enable-pcntl --enable-bcmath --enable-mbstring --with-gettext --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-gd --with-jpeg --with-zlib --with-freetype --with-webp=/usr/include/webp --with-curl --with-openssl=/usr/local/ssl --with-mhash --with-zip --with-bz2 --with-sodium

还是要记录一下的原因是有些配置项发生了变化,我花了一些时间查看了这些模块的安装要求,有一些配置是不需要再写上去了

php-fpm 需要 --enable-fpm
cli 不需要

mbstring 需要 --enable-mbstring 另外 --disable-mbregex:禁用正则表达式函数中多字节字符的支持
gettext 需要 --with-gettext[=DIR] DIR 默认是/usr/local
iconv 不需要 --without-iconv 禁用 --with-iconv[=DIR] 指定 iconv 在系统里的路径

socket 需要 --enable-sockets
SOAP 需要 --enable-soap
BC高精度数学函数 需要 --enable-bcmath

XML-RPC 需要 --with-xmlrpc[=DIR] php8已经不支持,转为pecl

libxml 不需要 --disable-libxml禁用
Opcache 不需要 但使用需要 php.ini 中配置

pcntl 需要 --enable-pcntl

gd 需要 --enable-gd
jpeg 需要 --with-jpeg
png 不需要 但需要安装 libpng 和 zlib
webp 需要 --with-webp
Zlib 需要 --with-zlib[=DIR]

xsl 需要 --with-xsl[=DIR]

cURL 需要 --with-curl[=DIR]
OpenSSL 需要 --with-openssl[=DIR]
mhash 需要 --with-mhash[=DIR]
zip 需要 --with-zip
Bzip2 需要 --with-bz2[=DIR]

Shmop 需要 --enable-shmop
sodium 需要 --with-sodium[=DIR]

posted @ 2022-06-20 19:36  忘忧般若汤  阅读(1658)  评论(0编辑  收藏  举报