LNMP-Compile and install PHP

Source: Internet
Author: User

Linux version: CentOS 6.7

kernel version: 2.6.32-573.el6.x86_64

PHP Version: 5.4.37


Create user PHP-FPM:

# useradd-s/sbin/nologin php-fpm


Configuring compilation Parameters :

# CD php-5.4.37

#./configure \

--prefix=/usr/local/php \

--WITH-CONFIG-FILE-PATH=/USR/LOCAL/PHP/ETC \

--ENABLE-FPM \

--WITH-FPM-USER=PHP-FPM \

--WITH-FPM-GROUP=PHP-FPM \

--with-mysql=/usr/local/mysql \

--with-mysql-sock=/tmp/mysql.sock \

--with-libxml-dir \

--WITH-GD \

--with-jpeg-dir \

--with-png-dir \

--with-freetype-dir \

--with-iconv-dir \

--with-zlib-dir \

--with-mcrypt \

--ENABLE-SOAP \

--ENABLE-GD-NATIVE-TTF \

--ENABLE-FTP \

--enable-mbstring \

--ENABLE-EXIF \

--enable-zend-multibyte \

--disable-ipv6 \

--with-pear \

--with-curl \

--with-openssl


If some errors occur during configuration, it is generally because some libraries are missing, it is best to download some library files before configuring them:

# yum install-y gcc libxml2 libxml2-devel OpenSSL openssl-devel libcurl libcurl-devel Libjpeg-turbo libjpeg-turbo-devel L Ibpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel

Like the Libmcrypt file does not exist in the Yum source for CentOS 6, so install this library file before installing a third-party source:

# RPM-IVH ' http://www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm '

After the library file is installed, and then configured, after the completion of the echo $?, if the output is 0, then you can compile it, or just look at it.


Compile, install:

# Make && make install

Do you want echo $ after each step? See if it's not equal to 0.


Copy PHP global configuration file php.ini:

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


To modify the PHP-FPM configuration file php-fpm.conf:

# vim/usr/local/php/etc/php-fpm.conf

Write the following to the file: it contains www. test.com The pool at this test station WWW, and the sock file for Nginx to read

[Global]

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

Error_log =/usr/local/php/var/log/php-fpm.log

[Test]

Listen =/tmp/test.sock

user = PHP-FPM

Group = PHP-FPM

Listen.owner = Nobody

Listen.group = Nobody

PM = dynamic

Pm.max_children = 50

Pm.start_servers = 20

Pm.min_spare_servers = 5

Pm.max_spare_servers = 35

Pm.max_requests = 500

Rlimit_files = 1024


Verify that the configuration is correct after the configuration is complete:

#/usr/local/php/sbin/php-fpm-t


Copy the PHP-FPM startup script file:

# CP/USR/LOCAL/SRC/PHP-5.4.37/SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM

# chmod 755/ETC/INIT.D/PHP-FPM


Start PHP-FPM:

# service PHP-FPM Start


To see if the PHP-FPM process starts normally:

# PS aux |grep php-fpm

This article is from the "Parody Games" blog, so be sure to keep this source http://kevinjin117.blog.51cto.com/11655131/1840278

LNMP-Compile and install PHP

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.