PHP7 Installation Configuration tutorial (very detailed)

Source: Internet
Author: User
Tags fpm ini mcrypt php website sapi zend git clone

# Install MCrypt

Yum install-y php-mcrypt Libmcrypt libmcrypt-devel

# Upgrade Bison

cd/var/soft/
wget http://ftp.gnu.org/gnu/bison/bison-2.6.4.tar.gz
Tar-xvzf bison-2.6.4.tar.gz
CD bison-2.6.4
./configure
Make && make install

# upgrade RE2C To resolve your would need re2c 0.13.4 or later if you want to regenerate PHP parsers. Error


cd/var/soft/
wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download
Tar zxf re2c-0.13.5.tar.gz && CD re2c-0.13.5
./configure
Make && make install

Compiling PHP7


# Create a Table of contents
Mkdir-p/VAR/SOFT/PHP7
Cd/var/soft/php7
# Download Source code
git clone http://git.php.net/repository/php-src.git
CD PHP-SRC
./buildconf
# Configuration Parameters
./configure--PREFIX=/USR/LOCAL/PHP7 \
--WITH-CONFIG-FILE-PATH=/USR/LOCAL/PHP7/ETC \
--with-mcrypt=/usr/include \
--WITH-MYSQL=MYSQLND \
--WITH-MYSQLI=MYSQLND \
--WITH-PDO-MYSQL=MYSQLND \
--WITH-GD \
--with-iconv \
--with-zlib \
--enable-xml \
--enable-bcmath \
--ENABLE-SHMOP \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--ENABLE-FPM \
--enable-mbstring \
--ENABLE-FTP \
--ENABLE-GD-NATIVE-TTF \
--WITH-OPENSSL \
--ENABLE-PCNTL \
--enable-sockets \
--WITH-XMLRPC \
--enable-zip \
--ENABLE-SOAP \
--without-pear \
--with-gettext \
--enable-session \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir \
--enable-opcache
#################################################################################
#/encodings.c:101:undefined reference to ' Libiconv_close ' error when compiling PHP installation
# The following error occurred while loading PHP:
#/root/downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:73:undefined reference to ' Libiconv_open '
#/root/downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:81:undefined reference to ' Libiconv '
#/root/downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:101:undefined reference to ' Libiconv_close '
#/root/downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:101:undefined reference to ' Libiconv_close '
# Collect2:error:ld returned 1 exit status
# Make: * * * * [sapi/cli/php] Error 1
# According to the PHP website described this is a bug (https://bugs.php.net/bug.php?id=52611). After configure to manually modify the makefile file, find Extra_libs in the last add-liconv can be successfully passed
# (approximately 104 of the makefile file)
# extra_libs =-LCRYPT-LZ-LRESOLV-LCRYPT-LRT-LMYSQLCLIENT-LMCRYPT-LLTDL-LPNG-LZ-LJPEG-LCURL-LZ-LRT-LM-LDL- Lnsl-lxml2-lz-lm-ldl-lssl-lcrypto-lcurl-lxml2-lz-lm-ldl-lfreetype-lmysqlclient-lz-lm-lssl-lcrypto-ldl-l XML2-LZ-LM-LDL-LXML2-LZ-LM-LDL-LCRYPT-LXML2-LZ-LM-LDL-LXML2-LZ-LM-LDL-LXML2-LZ-LM-LDL-LXML2-LZ-LM- Ldl-lssl-lcrypto-lcrypt-liconv
#################################################################################
# Compile installation

Make && sudo make install

# Configuration

CP Php.ini-production/usr/local/php7/etc/php.ini
CP SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP7-FPM
chmod +x/etc/init.d/php7-fpm
Cp/usr/local/php7/etc/php-fpm.conf.default/usr/local/php7/etc/php-fpm.conf
Cp/usr/local/php7/etc/php-fpm.d/www.conf.default/usr/local/php7/etc/php-fpm.d/www.conf

# Configure Opcache

Vim/usr/local/php7/etc/php.ini


# Join


Zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20141001/opcache.so
# Start


/etc/init.d/php7-fpm Start


# view PHP version

/usr/local/php7/bin/php-v

Results:

PHP 7.0.0-dev (CLI) (Built:www.111cn.net mar  3 2015 10:02:26)
Copyright (c) 1997-2015 the PHP Group
Zend Engine V3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
    with Zend opcache V7.0.4-dev, Copyrig HT (c) 1999-2015 by 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.