Nginx Series (four. Nginx and PHP)

Source: Internet
Author: User
Tags fpm mcrypt pear sapi
First, download PHP

Download Address: http://php.net/downloads.php

Second, PHP dependency library

-y libxml2 libxml2-devel gd-devel

Third, compile PHP

1.php Compilation parameter Configuration

.--prefix=--with-config-file-path=--with-gd\--enable-mbstring--with-pdo-mysql--with-mysql--enable-fpm

The output of the following is configured successfully

2. Compiling PHP

makemake install

The output of the following is configured successfully

Iv. Start PHP-FPM

1. Copy the PHP-FPM to the PHP directory

cp /home/download/php/sapi/fpm/php-fpm /web/php/bin/php-fpm

2. Copy the PHP configuration file to the Config directory

mkdir -p /web/php/configcp /home/download/php/php.ini-development /web/php/config/php.ini#生成环境下复制php.ini-production

3. Copy the PHP-FPM configuration file to the Config directory

cp /home/download/php/sapi/fpm/php-fpm.conf /web/php/config/

4. Start PHP-FPM

./php-fpm-y /web/php/php-fpm.conf

5. Configure Nginx and start Nginx
1. Modify Nginx configuration file to support PHP

location ~ \.php$ {            root           /web/www;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            include        fastcgi_params;            fastcgi_param   SCRIPT_FILENAME$document_root$fastcgi_script_name;            fastcgi_param   SCRIPT_NAME$fastcgi_script_name;        }

2. Start the Nginx service

start

The output of the following is configured successfully

Five, PHP compilation parameters detailed

The specific parameter meaning can be viewed using the./configure–help.

The list is as follows (some parameters have not been explained):
Specify the PHP installation directory
–prefix=/usr/local/php

Specify PHP.ini location
–with-config-file-path=/usr/local/php/etc

MySQL installation directory, support for MySQL
–with-mysql=/usr/local/mysql

MYSQLI extension technology can not only invoke MySQL's stored procedures, handle MySQL transactions, but also make access to the database work more stable.
–with-mysqli=/usr/local/mysql/bin/mysql_config

The integrated APACHE,APXS function is to use the LoadModule directive in MOD_SO to load the specified module to Apache, which requires Apache to open the so module
–with-apxs2=/usr/local/apache/bin/apxs

The option directive –with-iconv-dir is used to specify the path of Iconv in the system when PHP is compiled, otherwise the default path is scanned.
–with-iconv-dir=/usr/local

–with-freetype-dir open support for FreeType font libraries
–with-jpeg-dir open support for JPEG images
–with-png-dir open support for PNG images
– With-zlib-dir open support for Zlib Library for HTTP compressed transport
–with-libxml-dir Open LIBXML2 Library support
–disable-rpath close additional runtime files
– Enable-bcmath Open the picture resizing, use the Zabbix Monitor to use this module
–enable-shmop–enable-sysvsem so that your PHP system can handle the relevant IPC functions.
–enable-inline-optimization tuning Thread
–with-curl Open the support for the Curl Browsing tool
–with-curlwrappers open the URL stream using the Curl tool
– Enable-mbregex
–ENABLE-FPM has this parameter after PHP-FPM patch, CGI installed launcher
–enable-mbstring multibyte, string support
–with-mcrypt MCrypt algorithm extension
–with-mhash mhash algorithm extension
–WITH-GD open GD Library support
–enable-gd-native-ttf support TrueType string function library
– With-openssl OpenSSL support, encrypt the transmission of HTTPS used by the
–enable-pcntl FreeTDS need to use, may be linked to MSSQL only use
–enable-sockets open sockets support Br>–with-xmlrpc Open Xml-rpc's C language
–enable-zip open support for zip
–enable-ftp Open FTP support

–WITH-BZ2 opening support for bz2 files
–without-iconv Close Iconv function, conversion between character sets
–with-ttf Open freetype1.* Support, can not add
–with-xsl opens XSLT file support, expands the LibXML2 library, requires LIBXSLT software
–with-gettext opens the GNU gettext Support, the code library uses the
–with-pear Open the support for Pear command, PHP extension with
–enable-calendar opening the Calendar extension feature
Meta-data support for –ENABLE-EXIF images
–enable-magic-quotes Support for Magic quotes

–disable-debug turning off debug mode
–with-mime-magic=/usr/share/file/magic.mime Magic Head File location

Parameters for CGI mode installation

–ENABLE-FASTCGI support FastCGI way to start PHP
–enable-force-cgi-redirect redirect mode to start PHP
–with-ncurses supports ncurses screen drawing and dynamic library based on text terminal's interactive function of graphics
–WITH-GMP should be supportive of a specification
–enable-dbase establishing a DBA as a shared module
–with-pcre-dir=/usr/local/bin/pcre-config Perl's regular library installation location
–disable-dmalloc
–WITH-GDBM DBA's GDBM support
–enable-sigchild
–enable-sysvshm
–enable-zend-multibyte Multi-byte support for Zend
–enable-wddx
–enable-soap

Vi. Reference Address

1.php Official Installation Guide: http://php.net/manual/zh/install.unix.nginx.php

The above describes the Nginx series (four. Nginx and PHP), including the aspects of the content, I hope to be interested in the PHP tutorial friends helpful.

  • 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.