CentOS PHP编译安装

PHP · 2024-01-04

CentOS libiconv安装

检查是否存在

whereis libiconv.so.2
find / -name libiconv.so.2

下载

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.1.tar.gz
tar -zxvf libiconv-1.16.1.tar.gz
cd libiconv-1.16.1

编译并安装

./configure --prefix=/usr/local
make && make install
ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
ldconfig

PHP

下载并解压

wget https://www.php.net/distributions/php-7.4.33.tar.gz
tar zxvf php-7.4.33.tar.gz
cd php-7.4.33

编译

./configure --prefix=/usr/local/php7 \
--with-config-file-path=/usr/local/php7/etc \
--with-config-file-scan-dir=/usr/local/php7/etc/php.d \
--enable-mysqlnd \
--with-mysqli \
--with-pdo-mysql \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-gd \
--with-iconv \
--with-zlib \
--enable-xml \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--disable-mbregex \
--enable-ftp \--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--with-zip \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-curl \
--enable-bcmath \
--enable-opcache \
--with-apxs2=/usr/bin/apxs

安装

make && make install -j2  #-j2启动两个进程



PHP Linux CentOS
Theme Jasmine by Kent Liao