LNMP (nginx php-fpm mysql) environment deployment--php

Source: Internet
Author: User

Objective:

Previously said that the deployment of the original intention, if not clear, you can look at the preface of the previous article or leave a message in the comment area to me.

This article mainly describes the installation of php,php will be used to the MySQL connection database


Get ready:

PHP Official website: php.net

SOURCE directory:/USR/LOCAL/SRC

PHP uses the source installation method

The system is: CentOS 6.8

PHP uses version 5.6. The latest version is version 7, so if the new project is available in version 7, it is recommended not to upgrade to 7 for older projects that are not ready for refactoring.


Installation:

1 Install tool, configure the development package to install what is missing when compiling

Yum install-y wget make gcc libxml2-devel opensll-devel bzip2-devel libcurl-devel gd-devel

2 Download source package and signature file

wget wget HTTP://CN2.PHP.NET/DISTRIBUTIONS/PHP-5.6.28.TAR.GZ.ASC

3 Verify the file signature and verify that the key number is given without a key and that no public key is indicated

GPG--verify PHP-5.6.28.TAR.GZ.ASC

4 Download Key

GPG--keyserver keys.gnupg.net--recv-key 33cfc8b3

5 Verifying the signature again

GPG--verify PHP-5.6.28.TAR.GZ.ASC
Gpg:signature made Wed Nov 9 10:24:59 CST using RSA key ID 33cfc8b3gpg:good Signature from "Ferenc Kovacs <[ema Il protected]> "Gpg:WARNING:This key is not certified with a trusted signature!gpg:there is no indication th At the signature belongs to the owner. Primary key fingerprint:6e4f 6ab3 21FD c07f 2c33 2e3a c2bf 0bc4 33CF c8b3

Note: The source package and the signature file are placed under the same path

See good signature both prove successful , the following warning is that the signature is not trusted, this to pass the final key fingerprint and signer authentication, http://php.net/downloads.php#gpg-5.6 official gave the key fingerprint


6 Decompression

Tar zxf php-5.6.28.tar.gzcd php-5.6.28.tar.gz


7 Configuring compilation Parameters

./configure--help./configure--prefix=/usr/local/php--with-config-file-path=/etc--with-mysql--with-mysqli-- WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--enable-fpm--with-gd--with-iconv--with-zlib--enable-xml-- Enable-inline-optimization--with-openssl--enable-pcntl--enable-zip--with-curl--with-bz2--with-jpeg-dir-- With-png-dir--enable-mbstring

8 Compiling

Makemake Install

9 Configuring PHP Services

CP php.ini-production/usr/local/php/etc/php.iniln-s/usr/local/php/etc/php.ini/etc/php.ini# Copy template file for php-fpm config file CP/ usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf ln-s/usr/local/php/etc/php-fpm.conf/etc/ php.ini# Add start service cp sapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm chmod +x/etc/rc.d/init.d/php-fpmchkconfig PHP-FPM On

PHP-FPM by default with Port 9000, you need to add a iptables rule that allows web CGI to request PHP.

Web cluster/Reverse proxy IP segment 172.16.10.0/24

Iptables-i input-s 172.16.10.0/24-p TCP--dport 9000-j ACCEPT


10 Testing

Echo ' <?php phpinfo ();? > ' Info.php/usr/local/php/bin/php-f info.php


11 Starting the PHP-FPM service

Service PHP-FPM Start



This article is from the "Morrowind" blog, make sure to keep this source http://morrowind.blog.51cto.com/1181631/1875224

LNMP (nginx php-fpm mysql) environment deployment--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.