Home >Backend Development >PHP Tutorial >Linux source code compilation of php5.4 and above comes with the configure parameters and dependency packages of php-fpm

Linux source code compilation of php5.4 and above comes with the configure parameters and dependency packages of php-fpm

WBOY
WBOYOriginal
2016-08-08 09:25:381441browse

I often need to compile and install PHP myself in the Linux environment. There are many configure parameters. Sometimes I have to recompile PHP when I use it without paying attention, so the commonly used configure commands are organized as follows.

The first step is to install the dependent package:

yum -y install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel libaio

In fact, you may also need to install the mcrypt extension (typical error: phpmyadmin reports an error and cannot load the mcrypt extension).

To install the mcrypt extension, you can use the command:

yum install libmcrypt-devel

Then use the command:

yum install php-mcrypt

The mcrypt extension is successfully installed.

Second step, install php:

cd /tmp
wget http://cn2.php.net/get/php-5.5.10.tar.gz/from/cn2.php.net/mirror
tar -zxvf mirror
cd ./php-5.5.10

Then execute the command:

./configure \
--prefix=/usr/local/php5 \
--with-config-file-path=/usr/local/php5/etc \
--with-bz2 \
--with-curl \
--enable-ftp \
--enable-sockets \
--disable-ipv6 \
--with-gd \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-freetype-dir=/usr/local \
--enable-gd-native-ttf \
--with-iconv-dir=/usr/local \
--enable-mbstring \
--enable-calendar \
--with-gettext \
--with-libxml-dir=/usr/local \
--with-zlib \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-mysql=mysqlnd \
--enable-dom \
--enable-xml \
--with-libdir=lib64 \
--enable-pdo \
--enable-fpm \
--enable-mcrypt

The compilation process may report the following error:

checking for known struct flock definition… configure: error: Don’t know how to define struct flock on this system, set –enable-opcache=no

The solution is:

yum groupinstall "Development tools"

Finally execute the commands separately:

make
make install

The above introduces the configure parameters and dependency packages of php-fpm that come with Linux source code compilation of php5.4 and above, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn