php编译安装

Posted helloworld899

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php编译安装相关的知识,希望对你有一定的参考价值。

Centos6 环境:

yum install libxml2-devel curl-devel libpng-devel freetype-devel -y

./configure --prefix=/usr/local/php-7.x.x \
--with-mysqli=mysqlnd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv-dir \
--with-freetype-dir \
--with-zlib \
--with-mhash \
--with-libxml-dir \
--with-curl \
--with-mcrypt \
--with-gd \
--with-openssl \
--enable-ftp \
--enable-xml \
--enable-sockets \
--enable-bcmath \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-pcntl \
--enable-sockets \
--enable-fpm \
--enable-soap \
--enable-zip \
--enable-opcache

make -j24
make install

安装相关扩展:

第一种是使用pecl:

pecl install swoole
pecl install redis 

 

第二种是下载扩展源码安装:

#swoole编译,添加--enable-coroutine编译参数启用协程能力
git clone https://github.com/swoole/swoole-src.git
cd swoole-src/
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-coroutine
make && make install

 


相关错误记录:
configure: error: xml2-config not found. Please check your libxml2 installation.
=>yum install libxml2-devel -y

configure: error: Please reinstall the libcurl distribution -
=>yum -y install curl-devel

checking for jpeg_read_header in -ljpeg... yes
configure: error: png.h not found.
=>yum install libpng-devel -y


If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.
=>yum install freetype-devel -y

yum install libxml2-devel curl-devel libpng-devel freetype-devel -y

 

 

像这种安装部署的事情可以用Ansible或SaltStack固化下来,形成统一标准化配置。

 











































以上是关于php编译安装的主要内容,如果未能解决你的问题,请参考以下文章

编译安装 PHP 扩展

PHP8、FPM及部分扩展编译安装

gmp如何编译安装?Php已经装好了,想增加这个模块。

linux下安装php编译参数

php5.5.38编译安装

如何在openSUSE42.1下编译安装PHP7