PHP 7 Compiler installation Configuration Tutorial detailed

Source: Internet
Author: User
Tags curl fpm ftp gmp openssl php compiler zend automake

PHP compiler installation is quite simple, and each version is not very different, because the previous version of the compilation of the installation process can also be referenced, of course, it should be noted that each version of the compilation parameters are part of the difference, in the./configure--help in the specific description of the compilation configuration parameters prevail.

The system environment in this article is CentOS 7 64bit, such as the use of other system environments, please note the differences in some dependent installation links.

Preparatory work

For CentOS, yum I have always been used as a tool to install bulk dependencies, so a brain installation of these dependent libraries.

Yum install-y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel LIBXML2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses Curl Openssl-devel gdb M-devel db4-devel libxpm-devel libx11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c Xmlrpc-c-devel

Of course, individual dependent libraries may need to compile the installation manually, so pay attention to this issue. In the following, I'll make some notes for some dependent libraries, components.

In addition to the above dependencies, we also need to view the PHP compile installation documentation to confirm that additional components are required.

In the INSTALL file in the source package, you can see the instructions:

Prerequisite knowledge and software for compiling:
Basic Unix Skills (being able to operate "make" and a C compiler)
An ANSI C compiler
A Web Server
Any module specific components (such as GD, PDF Libs, etc.)

When building directly from Git sources or after custom modifications

You might also need:
autoconf:2.13+ (for PHP < 5.4.0), 2.59+ (for PHP >= 5.4.0)
automake:1.4+
libtool:1.4.x+ (except 1.4.2)
Re2c:version 0.13.4 or newer
Flex:version 2.5.4 (for PHP <= 5.2)
Bison:version 1.28 (preferred), 1.35, or 1.75

We have already installed GCC, automake, autoconf and so on, also need re2c and bison these two. Both of these are PHP parsers. (Re2c released a new version 9 hours before writing this article). Download address for both:

RE2C http://sourceforge.net/projects/re2c/files/0.15.3/re2c-0.15.3.tar.gz

Bsion http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz

Then compile the installation separately, these two compile installs do not need any special configuration parameter, very direct.

Of course, there is libmcrypt this thing, download address: ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz. This thing has to be.

Compiling and installing PHP

First, download the source package from the GitHub: https://github.com/php/php-src/archive/php-7.0.0.tar.gz

Download after decompression, into the PHP source directory:

Tar zxvf php-7.0.0.tar.gz
CD php-src-php-7.0.0
Invoke buildconf to generate configure files:

./buildconf--force
Once the Configure file is generated, we need to start the configuration of the build installation, and if you want to know what compile configuration options are available, just./configure--help can be viewed.

The reference configuration is as follows:

./configure \
--prefix=/usr/local/php/7.0.0 \
--WITH-CONFIG-FILE-PATH=/USR/LOCAL/PHP/7.0.0/ETC \
--WITH-CONFIG-FILE-SCAN-DIR=/USR/LOCAL/PHP/7.0.0/ETC/CONF.D \
--ENABLE-FPM \
--with-fpm-user=web \
--WITH-FPM-GROUP=WWW \
--ENABLE-SOAP \
--WITH-OPENSSL \
--with-openssl-dir \
--with-mcrypt \
--with-pcre-regex \
--with-zlib \
--with-iconv \
--WITH-BZ2 \
--enable-calendar \
--with-curl \
--WITH-CDB \
--enable-dom \
--ENABLE-EXIF \
--with-pcre-dir \
--ENABLE-FTP \
--WITH-GD \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-gettext \
--WITH-GMP \
--with-mhash \
--enable-mbstring \
--WITH-LIBMBFL \
--with-onig \
--ENABLE-PDO \
--with-pdo-mysql \
--with-zlib-dir \
--with-readline \
--enable-session \
--ENABLE-SHMOP \
--enable-simplexml \
--enable-sockets \
--ENABLE-SYSVMSG \
--enable-sysvsem \
--ENABLE-SYSVSHM \
--ENABLE-WDDX \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--ENABLE-MYSQLND \
--WITH-MYSQLI \
--without-pear
After the configuration has finished, perform the compile installation:

Make && make install
Done! Now you only need to/usr/local/php/7.0.0/bin the executable file in the/bin can be soft, of course, you can also choose the PATH environment variable specified in the paths, so that you can access the PHP parsing executor globally.

When finished, perform the PHP-V output:

PHP 7.0.0 (CLI) (Built:dec 3 2015 11:29:49) (NTS)
Copyright (c) 1997-2015 the PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.