centos 编译PHP7.2.31

Linux下的PHP编译安装

升级CURL

rpm -ivh http://mirror.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-1.rhel7.noarch.rpm




PHP编译安装

-------------------------------------------------------------------------------------------------------------------------------

安装依赖

yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libxslt libicu-devel libxslt-devel




编译参数

./configure \

--prefix=/usr/local/php-7.2.31 \

--with-mhash \

--with-openssl \

--with-config-file-path=/usr/local/php-7.2.31/etc \

--disable-short-tags \

--enable-fpm \

--enable-xml \

--with-libxml-dir \

--enable-bcmath \

--enable-calendar \

--enable-intl \

--enable-mbstring \

--enable-pcntl \

--enable-shmop \

--enable-soap \

--enable-sockets \

--enable-zip \

--enable-mbregex \

--enable-mysqlnd \

--enable-mysqlnd-compression-support \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-gd \

--enable-ftp \

--with-curl \

--with-xsl \

--with-iconv \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--enable-sysvsem \

--enable-inline-optimization \

--with-xmlrpc \

--with-gettext

make -j 4 && make install





设置环境变量

vim /etc/profile

PATH=$PATH:/usr/local/php-7.2.31/bin:/usr/local/php-7.2.31/sbin

export PATH

source /etc/profile




/usr/local/php-7.2.31/bin/phpize 

swoole 编译参数

./configure --enable-openssl \

--enable-mysqlnd \

--enable-http2 \

--with-php-config=/usr/local/php-7.2.31/bin/php-config

make && make install


如果遇到报错

freetype-config not found

参考:http://www.zhangchangyuan.com/article.php?id=47


1294 2021-04-25

JavaScript >>

Linux >>

PHP >>

HTML/CSS >>

C/C++ >>

MySql >>

常用工具使用 >>