centos8编译安装php8

2021年4月24日17:29:22

环境: php8.0.3 centos 8.3

./configure \
--prefix=/usr/local/php8 \
--with-config-file-path=/usr/local/php8/etc \
--with-curl \
--with-freetype \
--enable-gd \
--with-jpeg \
--with-gettext \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml \
--with-mysqli \
--with-openssl \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--enable-sockets \
--with-mhash \
--with-ldap-sasl \
--with-xsl \
--with-zlib \
--with-zip \
-with-bz2 \
--with-iconv \
--enable-fpm \
--enable-pdo \
--enable-bcmath \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-cli \
--enable-opcache \
--enable-intl \
--enable-calendar \
--enable-static \
--enable-mysqlnd \
--with-fpm-user=www \
--with-fpm-group=www 

注意:一些错误的处理

一般遇到  Package 'XXXX', required by 'virtual:world', not found)

多数情况下可以

Package 'libxml-2.0', required by 'virtual:world', not found
这样的错误都可以执行
yum search libxml2-devel
如果有,就是直接
yum install libxml2-devel

Package 'oniguruma', required by 'virtual:world', not found)

wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz 
tar xf oniguruma-6.9.4.tar.gz 
cd oniguruma-6.9.4/
./autogen.sh && ./configure --prefix=/usr
make && make install
cp php.ini-production /usr/local/php8/etc/php.ini

cd /usr/local/php8/etc/php-fpm.d/
cp www.conf.default www.conf

cd /usr/local/php8/etc/
cp php-fpm.conf.default php-fpm.conf

注意指定pid和socket的时候,主要吧文件配置到对应的php8目录下,因为很可能线上是多版本兼容的

posted on 2021-04-27 12:40  zh7314  阅读(1443)  评论(0编辑  收藏  举报