Nginx and php installation process in LNMP

Source: Internet
Author: User
Tags php source code

L: linux (system installation skipped. This article does not cover it)

M: Mysql (skipped in this article)

N: nginx

P: PHP

 

First install nginx

1. Download source code: Download To The http://wiki.nginx.org/Install, put it under/usr/src/software/nginx. (In other words, wiki.nginx.org is a good website with a wide range of documents. You can check it out when it's okay .)

Note that some modules of nginx depend on some third-party software, such as PCRE, OPENSSL, and zlib, which must be installed in advance.

 

2. download several very useful third-party Nginx extension modules, which are uniformly stored in/usr/src/nginx/exp (for example, it is very interesting to write Nginx modules. You can write them when you are free,)

1) echo-nginx-module (https://github.com/agentzh/echo-nginx-module,http://wiki.nginx.org/HttpEchoModule)

2) lua-nginx-module (http://wiki.nginx.org/HttpLuaModule)

3) set-misc-nginx-module (https://github.com/agentzh/set-misc-nginx-module)

4) ngx_cache_purge

For the installation process of the above modules, refer to the corresponding page on wiki.nginx.org.

 

Next, we install PHP:

1. First download PHP source code (http://www.php.net)

2. After decompression, configure./configure [various parameters]

There is a compilation example:

. /Configure -- disable-debug -- prefix =/usr/local/php -- enable-shmop -- with-gd -- with-jpeg-dir =/usr/lib64 -- with-png-dir =/usr/lib64 -- with-libxml-dir =/usr/lib64 -- with-zlib-dir =/usr/local/lib -- with-mysqli = mysqlnd -- with-mysql = mysqlnd -- with-pdo-mysql = mysqlnd -- enable-sockets -- with-iconv -- enable-mbstring -- enable-mbregex -- enable-ftp -- enable-gd-native-ttf --- curl -- enable-fpm -- enable-pcntl -- enable-sysvmsg -- enable-sysvsem -- enable-sysvshm -- enable-zip -- with-freetype-dir

Where,

-- Prefix = [path]: Set the installation path

-- Disable-debug: Debugging symbols cannot be added during compilation.

-- Enable-shmop: enables the shmop module. Shmop is an easy to use set of functions that allows PHP to read, write, create and delete Unix shared memory segments.

-- With-gd: added support for the GD library. The GD library is an extension library for php to process graphics.

-- With-jpeg-dir = [DIR]: prefix of the jpeg lib installation path in the GD library

'-- With-png-dir =/usr/lib64'' -- with-libxml-dir =/usr/lib64' '-- with-zlib-dir =/usr/lib64 ': similar to -- with-jpeg-dir

-- With-mysqli = FILE: supports mysqli. If the DIR value is mysqlnd, the MySQL native driver will be used mysql_config

-- With-mysql = DIR: supports mysql. If the DIR value is mysqlnd, the MySQL native driver will be used/usr/local

-- With-pdo-mysql = DIR: supports the PDO Mysql extension module. The PDO extension defines a lightweight and consistent interface for PHP to access the database. It provides a data access abstraction layer so that no matter what database is used, you can use consistent functions to query and obtain data. If the DIR value is mysqlnd, the MySQL native driver will be used/usr/local

-- Enable-sockets: added socket support.

-- With-iconv-dir = DIR: Activate iconv. iconv is activated by default and will be searched in the default path. The iconv function library can convert character sets. It is an indispensable basic function library in php programming.

-- Enable-mbstring: Enable multibyte string support

-- Enable-mbregex: This option is enabled by default. MBSTRING: enable multibyte regex (Regular Expression) support

-- Enable-ftp: Enable FTP support

-- Enable-gd-native-ttf: GD: Enable TrueType string function (ttf: TrueType string)

-- With-curl = [DIR]: Include cURL support

-- Enable-fpm: Enable building of the fpm SAPI executable (an important option to enable FPM Support)

-- Enable-pcntl: Enable pcntl support (CLI/CGI only) (php process control extension)

-- Enable-sysvmsg: Enable sysvmsg support. That is, System V Message Queue

-- Enable-sysvsem: Enable sysvsem support. That is, the System V semaphore.

-Enable-sysvshm: Enable sysvshm support. That is, System V shared memory.

In php, there are two groups of functions for operations on the Shared Memory segment: System v ipc and Shared Memory. Among them, the System v ipc series functions can operate data more conveniently, without having to know the offset and length during read/write as Shared Memory does, there is no need to serialize/deserialize back-and-forth conversions (because the Shared Memory function only supports data parameters in string format ). However, the System v ipc series does not support Windows, so to use it in a win environment, you can only select Shared Memory.

 

'-- Enable-zip': Include zip read/write support

-- With-freetype-dir = DIR: Related to the GD library. GD: Set the path to FreeType 2 install prefix

Related Article

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.