CentOS Compiler Installation php7.2

Source: Internet
Author: User
Tags configuration php gmp ldap mcrypt zts openldap
This article mainly introduces the CentOS compiler installation php7.2, has a certain reference value, now share to everyone, the need for friends can refer to

Introduced:

Heard PHP7 speed and performance that is faster than any version of the PHP5 series, the specific performance of how good, it is recommended to try to say first. If you are an upgrade or a new installation, you first need to consider the compatibility of PHP7 and the program, if the program is based on PHP5 development, then you need to consider whether PHP7 is suitable for your current production environment, today I will be real and installed in production.

First install the PHP dependency package, or in the process of compiling and installing PHP7 will appear a variety of error, after the installation is completed can enter the next link.

Install the expansion pack and update the system kernel:

Yum Install epel-release-yyum Update

To install a PHP dependent component (with Nginx dependencies):

Yum-y install wget vim pcre pcre-devel OpenSSL openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel LIBP ng Libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses Ncurses-devel Curl Curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost- Devel Bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-d Evel ReadLine readline-devel GMP gmp-devel libcurl libcurl-devel openjpeg-devel

Create users and groups, and download the PHP installation package decompression:

Cd/tmpgroupadd wwwuseradd-g www wwwwget http://am1.php.net/distributions/php-7.2.1.tar.gztar xvf php-7.2.1.tar.gzcd php-7.2.1

Set the variables and start compiling the source code:

cp-frp/usr/lib64/libldap*/usr/lib/
./configure--prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--enable-fpm \--with-fpm-user=www \--with-fpm-group=www \--enable-mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \-- Enable-mysqlnd-compression-support \--with-iconv-dir \--with-freetype-dir \--with-jpeg-dir \--with-png-dir \-- With-zlib \--with-libxml-dir \--enable-xml \--disable-rpath \--enable-bcmath \--enable-shmop \--enable-sysvsem \-- Enable-inline-optimization \--with-curl \--enable-mbregex \--enable-mbstring \--enable-intl \--with-mcrypt \-- WITH-LIBMBFL \--enable-ftp \--with-gd \--enable-gd-jis-conv \--enable-gd-native-ttf \--with-openssl \--with-mhash \-- Enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-zip \--enable-soap \--with-gettext \--disable-fileinfo \-- Enable-opcache \--with-pear \--enable-maintainer-zts \--with-ldap=shared \--without-gdbm

If there are no errors to perform the next installation, if there is an error during the compilation process, install the dependent package based on the error, usually this problem does not occur.

Note: –enable-gd-jis-conv This parameter causes the characters in the Zabbix to be garbled and is recommended to be canceled.

To start the installation:

Make-j 4 && make install

To complete the post-installation configuration php.ini file:

CP php.ini-development/usr/local/php/etc/php.inicp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/ Php-fpm.confcp/usr/local/php/etc/php-fpm.d/www.conf.default/usr/local/php/etc/php-fpm.d/www.conf

To modify php.ini related parameters:

vim/usr/local/php/etc/php.ini 
expose_php = Offshort_open_tag = Onmax_execution_time = 300max_input_time = 300memory_limit = 128Mpost_max_size = 32Mdate. TimeZone = Asia/shanghaimbstring.func_overload=2extension = "/usr/local/php/lib/php/extensions/ no-debug-zts-20170718/ldap.so "#OPcache Cache [opcache]zend_extension=/usr/local/php/lib/php/extensions/ No-debug-zts-20170718/opcache.soopcache.memory_consumption=128opcache.interned_strings_buffer=8opcache.max_ accelerated_files=4000opcache.revalidate_freq=60opcache.fast_shutdown=1opcache.enable_cli=1# set PHP security Functions Disable_ functions = Passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_ restore,dl,openlog,syslog,readlink,symlink,popepassthru# Configuration Www.conflisten =/var/run/www/php-cgi.socklisten.owner  = Wwwlisten.group = Wwwlisten.mode = 0660listen.allowed_clients = 127.0.0.1pm = Dynamiclisten.backlog = -1pm.max_children = 180pm.start_servers = 50pm.min_spare_servers = 50pm.max_spare_servers = 180request_terminate_timeout = 120request_ Slowlog_Timeout = 50slowlog = Var/log/slow.log 

Configure www.conf

Listen =/var/run/www/php-cgi.socklisten.owner = Wwwlisten.group = Wwwlisten.mode = 0660listen.allowed_clients = 127.0.0.1pm = Dynamiclisten.backlog = -1pm.max_children = 180pm.start_servers = 50pm.min_spare_servers = 50pm.max_spare_ Servers = 180request_terminate_timeout = 120request_slowlog_timeout = 50slowlog = Var/log/slow.log

Create a Php-cgi.sock storage directory

Mkdir/var/run/www/chown-r www:www/var/run/www

Configure php-fpm.conf

Vim/usr/local/php/etc/php-fpm.conf

Remove the following comment and fill in the full path:

PID =/usr/local/php/var/run/php-fpm.pid

This PHP7 is already installed.

Description: Disable PHP functions, if the program needs these functions, you can suppress the ban, novice suggestions ignore this step.

Create a system unit file php-fpm startup script:

Vim/usr/lib/systemd/system/php-fpm.service

Add the following variable contents:

[Unit] Description=the PHP FastCGI Process managerafter=syslog.target network.target[service]type=simplepidfile=/usr/local /PHP/VAR/RUN/PHP-FPM.PIDEXECSTART=/USR/LOCAL/PHP/SBIN/PHP-FPM--nodaemonize--fpm-config/usr/local/php/etc/ PHP-FPM.CONFEXECRELOAD=/BIN/KILL-USR2 $MAINPID [Install]wantedby=multi-user.target

Start the PHP-FPM service and join the power-on self-boot:

Systemctl Enable Php-fpm.servicesystemctl Restart Php-fpm.service

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.