Centos7 compiling php-5.6.11

Source: Internet
Author: User
Tags gettext imap mcrypt xsl

[Installation dependent]

Yum-y Install Epel-release
Yum Groupinstall "Development tools"
Yum-y Install Mhash mhash-devel mcrypt
Yum-y install zlib zlib-devel libjpeg libjpeg-devel freetype freetype-devel gd gd-devel Curl curl-devel libxml2 libxml2-d Evel Libxslt libxslt-devel libmcrypt libmcrypt-devel libc-client-devel postgresql-devel
Ln-s/usr/lib64/libc-client.so/usr/lib/libc-client.so
[Install Libiconv]
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

Tar xvf libiconv-1.14.tar.gz

CD libiconv-1.14

./configure--prefix=/usr/local/libiconv

Make &&make Install

(This software itself exists a bug, through Google, found a fix to solve the problem, the content is as follows:
1.---srclib/stdio.in.h.orig 2011-08-07 16:42:06.000000000 +0300
2.+++ srclib/stdio.in.h 2013-01-10 15:53:03.000000000 +0200
[Email protected]@ -695,7 +695,9 @@
4.
7.-_gl_warn_on_use (Gets, "gets is a security hole-use fgets instead");
8.+ #if defined (__glibc__) &&!defined (__uclibc__) &&!__glibc_prereq (2, 16)
9.+ _gl_warn_on_use (Gets, "gets is a security hole-use fgets instead");
10.+ #endif
#endif.

PS: "+" in the content means new content, "-" means the deleted content!

Then we just need to do the following to solve the problem: 1. Switch to the Srclib directory:
1. $CD Srclib
2. Modify the Stdio.in.h file:
1. $vi Stdio.in.h
By searching, navigate to _gl_warn_on_use (gets, "Get is a security hole-use fgets instead"), this line, and then add conditional compilation to this line, the modified content is as follows:


#if defined (__glibc__) &&!defined (__uclibc__) &&!__glibc_prereq (2, 16)
Gl_warn_on_use (Gets, "gets is a security hole-use fgets instead");
#endif
#endif
3\ Save exit, then make, makes install will be installed smoothly ^-^
)

[Compile PHP]

wget http://php.net/distributions/php-5.6.11.tar.gz

Tar xvf php-5.6.11.tar.gz

CD php-5.6.11

./configure--prefix=/usr/local/php \
--WITH-MYSQL=MYSQLND \
--WITH-MYSQLI=MYSQLND \
--WITH-PDO-MYSQL=MYSQLND \
--ENABLE-MYSQLND \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--WITH-LIBXML-DIR=/USR \
--enable-bcmath \
--ENABLE-SHMOP \
--enable-sysvsem \
--with-curl \
--ENABLE-FPM \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-mbstring \
--with-mcrypt \
--WITH-GD \
--ENABLE-GD-NATIVE-TTF \
--WITH-OPENSSL \
--with-mhash \
--ENABLE-PCNTL \
--enable-sockets \
--WITH-XMLRPC \
--enable-zip \
--ENABLE-SOAP \
--with-gettext \
--with-kerberos \
--with-imap=/usr/local/php-imap \
--WITH-IMAP-SSL \
--with-pcre-regex \
--ENABLE-EXIF \
--enable-mbregex \
--ENABLE-SYSVSHM \
--enable-inline-optimization \
--disable-rpath \
--with-pgsql \
--enable-calendar \
--with-zlib-dir \
--enable-xmlreader \
--enable-xmlwriter \
--enable-static \
--with-xsl \
--ENABLE-FTP \
--enable-opcache \
--disable-fileinfo

Make&&make Install

(such as ext/standard/.libs/basic_functions.o:in function ' zm_startup_basic ':/usr/local/soft/php-5.6.11/ext/ standard/basic_functions.c:3664:undefined reference to ' Zm_startup_dns ' error, could have been compiled, done clean and then compiled again

(./configure--prefix=/usr/local/php--with-pdo-pgsql--with-zlib-dir--with-freetype-dir--with-pcre-dir-- Enable-mbstring--with-libxml-dir=/usr--enable-soap--enable-calendar--with-curl--with-mcrypt=/usr/local/ Libmcrypt--with-zlib--with-gd--with-pgsql--disable-rpath--enable-inline-optimization--with-bz2--with-zlib-- Enable-sockets--enable-sysvsem--enable-sysvshm--enable-pcntl--enable-mbregex--enable-exif--enable-bcmath-- With-mhash--with-zlib--enable-zip--with-pcre-regex--with-mysql--with-pdo-mysql--with-mysqli--with-jpeg-dir=/ usr--with-png-dir=/usr--enable-gd-native-ttf--with-openssl--enable-ftp--with-imap-ssl--with-kerberos-- With-gettext--with-xmlrpc--with-xsl--enable-opcache=no--enable-fpm--with-fpm-user=www--with-fpm-group=www-- Disable-fileinfo--with-imap=/usr/local/php-imap)

[Add environment variable]

Export Path=/usr/local/php/bin: $PATH

Vim/etc/profile

Last line add

Export path= "/usr/local/php/bin: $PATH"

Source/etc/profile
[Copy configuration file]

CP Php.ini-production/usr/local/php/etc/php.ini

Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf

[Configure PHP-FPM as a service]

#!/bin/bash
#
# Startup script for the PHP-FPM server.
#
# chkconfig:345 85 15
# description:php is an html-embedded scripting language
# PROCESSNAME:PHP-FPM
# config:/usr/local/php/etc/php.ini
# Source function library.
. /etc/rc.d/init.d/functions
Php_path=/usr/local
desc= "PHP-FPM Daemon"
name=php-fpm
daemon= $PHP _path/php/sbin/$NAME
configfile= $PHP _path/php/etc/php-fpm.conf
ini_configfile= $PHP _path/php/etc/php.ini
pidfile= $PHP _path/php/var/run/$NAME. pid
Scriptname=/etc/init.d/$NAME

# Gracefully Exit If the package has been removed.
Test-x $DAEMON | | Exit 0
Rh_start () {
$DAEMON-y $CONFIGFILE-c $INI _configfile | | Echo-n "Already Running"
}
Rh_stop () {
Kill-quit ' Cat $PIDFILE ' | | Echo-n "Not Running"
}
Rh_reload () {
Kill-hup ' Cat $PIDFILE ' | | Echo-n "can ' t reload"
}
Case "$" in
Start
Echo-n "Starting $DESC: $NAME"
Rh_start
echo "."
;;
Stop
Echo-n "Stopping $DESC: $NAME"
Rh_stop
echo "."
;;
Reload
Echo-n "Reloading $DESC configuration ..."
Rh_reload
echo "Reloaded."
;;
Restart
Echo-n "Restarting $DESC: $NAME"
Rh_stop
Sleep 1
Rh_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
Exit 3
;;
Esac
Exit 0

chmod +x/etc/init.d/php-fpm
Service PHP-FPM Restart
Chkconfig--level php-fpm on

Nginx.conf to fill up













Access_log off;
Supplemental module approach (with IMAP as an example):
./configure--with-php-config=/usr/local/php5/bin/php-config--with-imap=/usr/lib64--with-imap-ssl-- With-kerberos make;make Install vi/etc/php.d/imap.ini extension =/usr/local/php5/lib/php/extensions/ no-debug-non-zts-20100525/imap.so Service PHP-FPM Restart

Centos7 compiling php-5.6.11

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.